Help with ng-if and server script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 08:21 AM
I have a list of items and each has an order. I have another variable that is set to the current record's order. I am trying to print all items that have been completed thus far. So for example:
List:
Label | Order |
---|---|
Step1 | 1 |
Step2 | 2 |
Step3 | 3 |
Step4 | 4 |
I query this table and push all rows into something named steps. I also get the current record's step number and store it in a variable steps.rec. Example:
steps.rec = 3;
In my html, I have an ng-repeat:
<div ng-repeat="step in c.data.steps">
This if followed up with a ng-if:
<div ng-if="steps.order <= steps.correct">
{{steps.label}}
</div>
The problem here is that I am only printing the current record label, not the ones before it. I should be printing Step1, Step3, Step3. I am only getting step3. Any thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 05:49 AM
So I ended up scrapping the ng-if and just using the ng-repeat with a filter. I set 2 filters in my client controller. This seems to work the way I need it for now and I will continue to work on making it more efficient and then share.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2020 08:27 AM