How to read data from angular resource promise

I am having a problem reading my data from an angular promise.

earlier i did

var data = category.get({id:userid});

      

Then I realized that the data returned unresolved promises. Then changed it to

category.get({id:userid}, function(result){
     console.log('the result are', result);
 });

      

When I print my result, I noticed that it is now a promise with my data inside Resource: 0 as shown below.

pFdeHox.png

Please, how can I access the Resource below? It doesn't seem to give access. Any help would be appreciated

0


source to share


1 answer


If you really want to use promise

, you can do:

category.get(...)
  .$promise.then(function(result)) { 
    console.log(result); 
  });

      



Otherwise, you are not using the promise.

0


source







All Articles