Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing several parameters - object and values
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Passing several parameters - object and values
Divers
Thread ID:
01609783
Message ID:
01609783
Vues:
44
Hi everybody,

I looked at this page

https://docs.angularjs.org/api/ng/service/$http

but it's still not clear to me.

I have the following sample:
var getAccounts = function(queryRequest) {
            var deferred = $q.defer();
            $http.get('/api/accounts', { params: queryRequest })
                .success(function(data) {
                    deferred.resolve(data);
                })
                .error(function(data, status, header, config) {
                    deferred.reject(status);
                });
            return deferred.promise;
        };

        var getAccountInvoices = function (acctNameHash, showFinalized) {
            var deferred = $q.defer();
            $http.get('/api/accounts/getAccountInvoices/' + acctNameHash + '/' + showFinalized)
                .success(function (data) {
                    deferred.resolve(data);
                })
                .error(function (data, status, header, config) {
                    deferred.reject(status);
                });
            return deferred.promise;
        };
Now, suppose I want to pass both to my getAccountInvoices - queryRequest object and two extra parameters (string and boolean). Should I just list them in the
config object using this syntax:
{ params: queryRequest, acctNameHash, showFinalized }
?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform