标签:details www ror username class top complete function angular2
http://blog.csdn.net/tianjun2012/article/details/51427417
代码如下: 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 => this.saveJwt(data.id_token), err => this.logError(err), () => console.log(‘Authentication Complete‘) ); }
angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法
标签:details www ror username class top complete function angular2
原文地址:http://www.cnblogs.com/annie211/p/7883385.html