<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<div ng-app>
<div ng-controller="SomeCtrl">
<input ng-model="textProperty"/>
<span>{{computedProperty()}}</span>
</div>
</div>
script
function SomeCtrl($scope) {
$scope.textProperty = "initial";
var times = 0;
$scope.computedProperty = function(){
console.log(++times);
return $scope.textProperty+ " asdf";
};
}
Is there way to avoid/workaround Angularjs computed property running twice everytime?
or Do I have to write directive for the one that I will never reuse on another controller?