Skip to content Skip to sidebar Skip to footer

Using Ngresource In An Angularjs Spa

I am using ngResource in a factory to fetch data from a REST API URL, and then do some basic processing on the retrieved data. This works fine (verified using console.log()). I inj

Solution 1:

Resources use asynchronous request. You have to wait for their promise to be resolved like this :

dataResource.get().$promise.then(function(object){
   $scope.trialData = object;// or maybe object.data
});

Post a Comment for "Using Ngresource In An Angularjs Spa"