Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing several parameters - object and values
Message
 
 
To
All
General information
Forum:
Javascript
Category:
Other
Title:
Passing several parameters - object and values
Miscellaneous
Thread ID:
01609783
Message ID:
01609783
Views:
43
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
Next
Reply
Map
View

Click here to load this message in the networking platform