Q: Angularjs - Method gets called automatically for underlying variable I noticed that methods get called automatically whenever the underlying $scope variable changes.
$scope.getLength = function() {
return $scope.length;
}

My html looks like the following
<div class="test">{{getLength}}</div>

Whenever I change $scope.length, the method updates the value on the UI. I know that variables get updated because of the MVVM binding in Angular. WHy does a method get called?

A: It is a binding is this case too; just a binding to a function. AngularJS updates all bound elements whenever it goes through a digest cycle.

A: Angular does invoke those bound function everytime the scope is getting changed, no matter if this $scope.length changed or any other scope variable.
But be careful with binding too much functions into scope like this... console.log something in the function and you will see.
working on enterprise angularjs app, binding functions within big scopes can cost like 5 % of cpu power invoking bound functions containing big calculations.
