Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angularjs Why does using .match inside of an ng-if seem to cause digest cycles

<div ng-controller="MyCtrl">
  <div ng-if="showValBool">
    {{val}}
  </div>
</div>
var myApp = angular.module('myApp',[]);

function MyCtrl($scope, $interval) {
    $scope.val = 0;
    $scope.showValBool = false
    $interval(function () {
        $scope.val = Math.trunc(Math.random() * 200);
        $scope.showValBool = String($scope.val).match(/[1]{1}[0-9]{2}/);
    }, 1000);
    
} 
 
PREVIOUS NEXT
Tagged: #angularjs #Why #digest #cycles
ADD COMMENT
Topic
Name
4+5 =