So I am doing an http request in my router thrugh resolve and I am wondering on how can I get a value from a factory inside my http request? I have a function in my factory that I want to call and get a value from and send that value through the http request. Is there any way I can inject a factory in the resolve function?
$routeProvider
.when('/', {
redirectTo: '/home'
})
.when('/home', {
templateUrl: 'views/main_portal.html',
controller: MyController15,
resolve: MyController15.loadAll
})
.when('/home/convo', {
templateUrl: 'views/convo.html',
})
.otherwise({
redirectTo: '/home'
});
MyController15.loadAll = {
//I WANT TO PASS A VARIABLE HERE TO USE IN THE PARAMS OBJECT.
allQ: function($http) {
return $http({
url: some_url,
method: post,
params: {action: 'someAction', valueToPass: ???????}
});
}
};
var MyController15 = ['allQ',
function(allQ){
//some data manipulation of allQ.data
}];