Answer the question
In order to leave comments, you need to log in
Sequentially executing queries using $resource?
Greetings!
And so, we have a factory:
app.factory('SettingProject', function($rootScope, $resource) {
return $resource($rootScope.storeUrl+'/settingProject&token='+$rootScope.token, {
id_setting: '@id',
setting_type: 'main',
setting_profiles: 'all'
},
{
'profiles': {
method: 'GET', params: {setting_profiles: 'all'}, isArray: true
},
'profile': {
method: 'GET'
}
});
});
// создаем запросы в контроллере
$scope.listProfiles = SettingProject.profiles({setting_profiles: 'all'});
$scope.listProfile = SettingProject.profile({id_setting: $routeParams.id_setting, setting_profiles: 'check'});
$scope.listProfiles = SettingProject.profiles({setting_profiles: 'all'}).$promise
.then(function(data) {
console.log($scope.listProfiles);
}, function(error) {
console.log(error);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question