number comparison

44 views
Skip to first unread message

Robert Bee

unread,
Mar 29, 2022, 7:41:43 AM3/29/22
to Angular and AngularJS discussion
Hi

I am trying to compare weekly sales figures, from a JSON file,  and indicate with an arrow whether they have gone up or down .

The code is:
    <td>{{ x.ThisWeek }}&nbsp;<img ng-src="{{ x.LastWeek<x.ThisWeek && 'Images/green.png' || 'Images/red.png'}}"></td>
    <td>{{ x.LastWeek }}&nbsp;<img ng-src="{{ x.Week2<x.LastWeek && 'Images/green.png' || 'Images/red.png'}}"></td>
    <td>{{ x.Week2 }}&nbsp;<img ng-src="{{ x.Week3<x.Week2 && 'Images/green.png' || 'Images/red.png'}}"></td>
    <td>{{ x.Week3 }}</td>  


  
but the results are mixed, see attachment, but ultimately wrong. I have parsefloat the Week2, Week3, LastWeek and ThisWeek but the results are worse.

Any ideas please?

Many Thanks

Rob Bee

Capture.PNG
Reply all
Reply to author
Forward
0 new messages