You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I'm quite new to Angular, and was looking for a convenient way to create headers in a ng-repeat list (like first letter headers in a list of names, or month headers in a list of dates).
It occurred to me it would really help if the previous item would be available in the loop, so headers could be created by:
<htmllang="en" ng-app="prevValueDemo"><head><scriptsrc="git/angular.js/build/angular.js"></script></head><bodyng-controller="prevController"><png-repeat="nr in nrs"><!-- note: below is nr_prev the previous value now !!!! --><spanng-if="(nr-nr%10)/10!=(nr_prev-nr_prev%10)/10" ><br><b>{{(nr-nr%10)/10}}0</b><br></span><span>
{{nr}}
</span></p><script>varprevValueDemo=angular.module('prevValueDemo',[]);prevValueDemo.controller('prevController',['$scope',function($scope){$scope.nrs=[12,14,15,22,23,45,46,76,78,79,80,83,99];}]);</script></body></html>
I'm not so sure this fits the Angular way of doing things though. Especially at my simple choice of name (postfixing '_prev' to 'nr' in this case).
If it does, i'll run tests & checks, test it in combination with filtering and create a merge request. If it doesn't I'm open to suggestions for another approach.