I'm trying to use AngularJS's ng-repeat to check if a value from a previous iteration is the same as the current.
if previous === current
After, the check I would like to update previous to equal current.
previous = current
I have no idea how to update values from inside an ng-repeat in Angular.
Here is an example:
<div ng-repeat="product in Products | filter: filters[0] | orderBy:'Section'">
<div ng-if="product.Section !== $parent.previous">
{{product.Section}}
</div>
$parent.previous = product.Section
</div>
Update:
While this question might still be helpful in some situations, after some thought I realised that what I really want is new objects grouping products by section: How can I group data with an Angular filter?