I have an array as follows:
[7500, 15000, 21300, 3600]
This array is printed in the view using ng-repeat. But my problem is, I'm updating this array every second using setInterval, it is fired, and works on controller but updated value is not shown in view. My code is given below:
JavaScript
angular
.module('controllers')
.controller('DashCtrl', DashCtrl);
function DashCtrl($scope, $window) {
var dash = this;
dash.alarmList = JSON.parse() ; // [7500, 15000, 21300, 3600]
dash.updateClock = function() {
for(var key in dash.alarmList) {
dash.alarmList[key] --;
}
}
setInterval( dash.updateClock, 1000);
}
HTML
<div class="list">
<a class="item item-icon-left" ng-repeat="alarm in dash.alarmList">
<i class="icon ion-person-stalker"></i>
{{alarm}}
<span class="badge badge-assertive">0</span>
</a>
</div>