Luddinus Luddinus - 1 year ago 99
AngularJS Question

Angular - Is possible to get the $http parameters?

short question

I have this:

let promise = $http.get('/api/users');

Can I get the promise's parameters? Something like this:

let promise = $http.get('/api/users');

let parameters = promise.getParameters();


parameters = {
method: 'GET',
url: 'api/users',
// etc.


I would like to make a Pagination service where I pass a promise and then I could change the url passing parameters (previous/next page etc.)



I need to explain better:

I'd like to pass the "main" promise to a PaginationService.

this.paginator = {};

Paginator.make(this.paginator, function (page) {
// this will be the "main" promise
// page = 1
return $http.get('/api/users', {
params: {
page: 1

// PaginatorService
this.make = function (scopePaginator, callback) { = function () {
return callback(scopePaginator.current_page);

return callback().then(function (response) {
// the response.meta contains all the data (current_page, etc.);


return scopePaginator;


Something like this is what I'm doing...

Answer Source

The configuration object that generated the request is part of the response object.

var promise = $http.get('/api/users');

promise.then(function onSuccess(response) {
    var config = response.config;

Thus successive $http calls can be chained from the promise.

promiseNext = promise.then(function onSuccess(response) {
    var config = response.config;[] =;;
    //return promise for chaining
    return $http(config);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download