I am trying to resolve a method like below using ui-router
$stateProvider
.state('abc', {
url: 'xyz',
templateUrl: 'templateURL',
controller: ctrl,
resolve:{
data: function(someService){
data = someService.init();
return data;
}
}
})
And my service code looks like this
var someObject = {
data1: ...,
data2: ....,
...
}
return{
init: function(){
promise1 = ...
promise2 = ...
promise3 = $http.get('someurl').then(function(){
...
...
//do some manipulation with someObj
return someObject;
});
$q.all(promise1 , promise2 ).then(promise3);
}
}
When I debug the code, it is coming to line return someObject
but then it is not resolving.
What am I doing wrong?