Answer the question
In order to leave comments, you need to log in
How to call a function in angularjs?
app.controller("test", function($scope, $http){
$scope.getTag = function(){
$http.get('/api/v0/todos/tags').success(function(data){
return data.items; // данные
});
}
$scope.showTasks = function (){
var tag = $scope.getTag(); // что-то не так
console.log(tag);
};
});
Answer the question
In order to leave comments, you need to log in
10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
Here's an error for you. You call an asynchronous function many times, before one has time to fire, you call the second and so on, because of this, angular tries to call the digest cycle every time and stumbles upon the fact that it is already running.
To do this, you need to call asynchronous functions not so often and many times, read about debounce (to call a function, for example, once every half a second)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question