システムにログインしようとしています。角度1ではオプションが利用できない、angular2 xhrfields withcredentials true
withCredentials:true
を設定する方法があった。しかし、私は今(beta.1)、angular2
export class LoginComponent {
constructor(public _router: Router, public http: Http,) {
}
onSubmit(event,username,password) {
this.creds = {'Email': '[email protected]','Password': '01010','RememberMe': true}
this.headers = new Headers();
this.headers.append('Content-Type', 'application/json');
this.http.post('http://xyz/api/Users/Login', {}, this.creds)
.subscribe(res => {
console.log(res.json().results);
});
}
}
これはChromeとFirefoxで動作しますしかしサファリは失敗する。 – harikrish
特にこれには当てはまりませんが、現在のベータ版(ベータ版)のSafari(国際化APIなど)にはまだ問題があります。 – cexbrayat
あなたは私はあなたがこれは私が ヘッダ= { ヘッダ送りますものですAPIの WIH送っているヘッダ何知らせることができます:({ 「受け入れる]新しいヘッダを:「アプリケーション/ JSON」、 「Content-Typeの」: 'application/json' }) }; – harikrish