Skip to content Skip to sidebar Skip to footer

How To Wait For Promise From UI Router Resolve In Angular 1.5 Component

I'm using Angular 1.5 Component. I could not figure out how to get the data via Resolve. Could you please shed some light? Plunker: https://plnkr.co/edit/2wv4YWn8YQvow6FDcGV0 <

Solution 1:

You had forgot to return a promise from your promiseFollowers promise.

promiseFollowers: function ($http) {
     return $http.get(...){
     }
}

And there after you also need to define a bindings option to retrieve a value passed from resolve

bindings: {
   promiseFollowers: '='
},

Demo Plunkr


Solution 2:

https://stackoverflow.com/a/18019915/6524138 do refer this should help if the above solution does not work.

Jist: "Inject resolve to the controller" should fix your issue.


Post a Comment for "How To Wait For Promise From UI Router Resolve In Angular 1.5 Component"