Encountering a peculiar problem in Angular 1 where the script is getting stuck in an endless loop, eventually causing the browser to freeze.
Here's what I'm attempting:
<script>
$scope.A = true;
$scope.B = [{blah},{blah}];
$scope.updateB = function(){
$scope.B.push({blah});
}
$scope.D = function(key){
$scope.A = false;
return key.name;
}
</script>
<div ng-if="A">
<button ng-click="updateB()"></button>
</div>
<div ng-repeat="key in B">
{{D(key)}}
</div>
In essence, I aim to hide the first div after the button is clicked. While it could be achieved within the "updateB" function, my preference is to accomplish it in "D", post expression evaluation. This, however, result in an infinite loop.
Any suggestions on what might be going awry here?