$scope.list
is a promise. In your case the promise has already been resolved, thus the $resolved: true
. But it's a promise none the less.
From the ngResource docs:
$promise: the promise of the original server interaction that created this instance or collection.
On success, the promise is resolved with the same resource instance or collection object, updated with data from server. This makes it easy to use in resolve section of $routeProvider.when() to defer view rendering until the resource(s) are loaded.
So in Angular 1.2+ you want to do something like this where you provide a callback using then
on the $promise
attribute of the promise. Once the promise is resolved the callback will then be called with the results (in your case since the promise is already resolved the callback will execute immediately).
link: function(scope,$element, attrs){
scope.list.$promise.then(function(results) {
console.log(results);
console.log("title ",results.title);
});
}
Here's a working demo fiddle that uses $httpbackend to simulate your server's response.