When utilizing AngularMaterial, I have implemented ng-checked
in the following manner:
<md-list>
<md-list-item ng-repeat="option in options">
<p> {{ option }} </p>
<md-checkbox class="md-secondary" aria-label="{{$index}}" ng-checked="exists($index)" ng-click="toggle($index)"></md-checkbox>
</md-list-item>
</md-list>
Here is my exists function:
$scope.exists = function (optionNum) {
console.log('Inside $scope.exists. Option: '+optionNum);
};
I also have a timer function:
function updateTimer() {
var onTimeout = function(){
mytimeout = $timeout(onTimeout,1000);
}
var mytimeout = $timeout(onTimeout,1000);
}
As a result, the $scope.exists
function is being called every second. Can someone provide insights into the relationship between ng-checked
and $timeout
, as well as how to prevent this continuous calling?