2017-02-04 58 views

回答

0

我認爲你需要發佈與查詢字符串參數

要做到這一點,你需要ŧ Ø在您的POST請求一些修改

var request = $http({ 
        method: "POST", 
        url: "", 
        transformRequest: transformRequestAsFormPost, 
        data: { 
         grant_type: "password", 
         username: "Kim", 
         password: "123", 
         scope: "read" 
        } 
       }); 

下面是詳細信息https://www.bennadel.com/blog/2615-posting-form-data-with-http-in-angularjs.htm

0

我想通了

var data = "grant_type=password" + "&username="+cred.username + "&password="+cred.password + 
      "&client_id=" + cred.client_id + 
      "&client_secret=" + cred.client_secret; 
     $http({ 
      method: 'POST', 
      url: 'BaseUrl', 
      data: data, 
      headers: {'Content-Type': 'application/x-www-form-urlencoded'} 

     }) 
解釋