2017-02-04 56 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'} 

     }) 
解释