Hi I need to resolve chained promise before my controller loads. According to: https://github.com/angular-ui/ui-router/wiki it should be possible. I have something like that:
usersInit: function (Restangular) {
return $.get(Restangular.configuration.baseUrl+"/users?limit=1").then(function(data){
var total = data.total;
return Restangular.all('users').getList({page: 1, limit: total});
})
}
And almost everything seems to be fine, I get all records via restangular (which is what I'm trying to achive, because my default restangular setting returns 20 records) but the object returned by return Restangular.all('users').getList is not resolved in my controller.
Any suggestions what's wrong? Or maybe any other way to get it working without chaining promises. I cannot use hardcoded high limit because in theory I can have even larger number of records.