I need to have a function in the scope which result will change asynchronously.
It's mandatory to have a function to be used as an expression, so I cannot use a single property.
In my example, the function returns a property of an object which will be modified asynchronously. This performs a digest error although the value is equal over the whole digest cycle. Here the example: http://plnkr.co/edit/YmyroMiMyMzUaLW4tc7V (Caution: it could hang your browser)
myApp.controller('Ctrl1', ['$scope', '$http', function($scope, $http) {
var myObj = {found:false};
$scope.util = {};
$scope.util.asyncFunc = function(){
$http.get('http://localhost').then(changeValue,changeValue);
return myObj.found;
}
function changeValue(){
myObj.found = true;
}
}]);
Any idea how to solve it?