I'm using AngularJS resource to call an API. When I get a list of items with the API, all shows well in my ng-grid. When I try to filter on for example employeename, angular returns me "digest already in progress". What could be the problem?
What I did to call the api is this:
'use strict';
angularApp.factory('absenceResource',['$resource',function($resource){
var baseUrl = config.apiurl;
var buildUrl = function(resourceUrl){
return baseUrl + resourceUrl;
};
return $resource(buildUrl('api/absences/:employee'),
{employee: '@employee'},
{
"update": {method: "PUT"}
});
}]);
Then to call that resource:
'use strict';
angularApp.factory('absenceData',function(absenceResource, authService){
return{
getAbsence: function(absenceId){
return absenceResource.query({id: absenceId});
},
getAllAbsences: function(){
return absenceResource.query();
},
getAllAbsencesForUser: function(user){
return absenceResource.query({'employee': user});
},
update: function(absence){
absenceResource.$update(absence);
},
save: function(absence){
absenceResource.save(absence);
}
};
Then in my controller I do this:
$scope.absencesForUser = absenceData.getAllAbsencesForUser("jurgen");
//$scope.absences = absenceData.getAllAbsences();
$scope.gridOptions = {
data: 'absencesForUser'
};
I then get the digest error.
I've searched for this problem, but all the problems that I've found had to do with $rootScope.apply and I don't use that.
Can somebody help me?