angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法

千磨万击还坚劲,任尔东西南北风。这篇文章主要讲述angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法相关的知识,希望能为你提供帮助。
angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法http://blog.csdn.net/tianjun2012/article/details/51427417
 
 
【angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法】代码如下: authenticate(data) { var username = data.credentials.username; var password = data.credentials.password; var creds = "username=" + username + "& password=" + password; var headers = new Headers(); headers.append(‘Content-Type‘, ‘application/x-www-form-urlencoded‘); this.http.post(‘http://localhost:3001/sessions/create‘, creds, { headers: headers }) .map(res => res.json()) .subscribe( data =https://www.songbingjia.com/android/> this.saveJwt(data.id_token), err => this.logError(err), () => console.log(‘Authentication Complete‘) ); }

    推荐阅读