Why does function in ng-show clause not keep on getting executed on each digest cycle

I am doing a test (while busy solving a different problem)

I have a div element defined as follows:

<div ng-show="myFunction()">
  //some content
</div>

In my controller I have the following JavaScript function:

 $scope.myFunction = function () {
    console.log("myFunction called");
    return true;
 }

I was expecting that in the browser console, when running this code, I will keep on seeing the words “myFunction called” being written over and over and over since I expect the function to be evaluated on each angular digest cycle. But what I am seeing is that it gets called a finite couple of times and then it no longer gets called.

Why is this?

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/09/29/why-does-function-in-ng-show-clause-not-keep-on-getting-executed-on-each-digest-cycle/
via @lzomedia #developer #freelance #web

Comments

Popular posts from this blog

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development

ng-show doesn’t work correct with value boolean

ng-include of inline SVG does not display gradient except in Chrome