私はイオンストレージに認証トークンを持っており、httpリクエストを通過させる必要がありますが、storage.get.then約束から値を得ることはできません。約束の外で変数を使用する方法
getProducts(){
let headers = new Headers();
this.token= this.storage.get('Authorization').then((value)=>{
this.token= value;
return this.token;
});
headers.append("Authorization",this.token);
return this.http.get('https://vjtest.cobold.xyz/vapi/public/api/products',{headers: headers})
.map(res=> res.json());
}
@wolverine私は内部http.getがhttp.getリターンが悪い申し訳ありませんgetProduct //ありがとう –