2
Django rest APIでangular2を使用しています。試みは、コンポーネントでこのメソッドを解決するときにDjango Rest angular2 http get
getAccountBackend(id: string) : Promise<any> {
const slash="/"
const urlaccount = `${this.urlAccontBackend}${id}${slash}`;
console.log('url du compte', urlaccount)
return this.http.get(urlaccount)
.toPromise()
.then(response => {
response.json().data
console.log(response)}
)
.catch(this.handleError);
}
:怒鳴るコードでサービスにHTTP GETを使用してアカウントを取得しようとしています
getAccountById(){
console.log("i will resolve the account");
this.fcbAccSrv.getAccountBackend('1234896')
.then(data=> {
this.compte=data
console.log("the account from the backend", this.compte);
})
.catch(error =>{ this.error = error;
console.log('error to resolve account')});
}
私は大丈夫HTTPでの応答を得たが、コンポーネント内のアカウントが定義されていない:
はい効果的に私は復帰を逃したが、そんなにuの感謝 – sila