2015-06-08 98 views
2

我有我的$ http.get帶有一個參數,它的工作原理是:

getUserBand: function(email) { 
     return $http.get(baseUrl + 'selectUserBand.php?email=' + email); 
    }, 

我想送2的參數,如:

getUserBand: function(email,param2) { 
     How to call 2 parameter in this field? 
    }, 

如何在$ http.get字段中調用email和param2?

回答

5

您可以將PARAM與 '&':

getUserBand: function(email,param2) {  
    $http.get(baseUrl + 'selectUserBand.php?email=' + email + '&param2=' + param2); 
} 
+0

太好了,謝謝。它與我合作:) – fxbayuanggara

4

存儲您所有的網址參數中的對象一樣,

var urlParams = { 
    'param1': email, 
    'param2': username 
}, 

現在使用下面的代碼發出請求,

$http({ 
    method: 'GET', 
    url: 'url from which you want to get', 
    params: urlParams //which will be automatically turned to ?key1=value1&key2=value2 after the url 
})