2
私はhttp.get
の文字列を返すために 'MyAddressConfig'を取得するのに少し問題があります。それはIonic2ストレージからデータを取得します。問題は、私はObservable http.getで購読する
が任意のアイデアhttp://localhost:0000/[object%20Object]my/path?&tst=1 404(見つかりません)
をGET!取得しておくことですかMyAddressConfig
GetDataFromStorage: Observable<any> =
Observable.fromPromise(
Promise.all([
this.ionicStorage_.get('MyRestIPAddress'), // 'localhost'
this.ionicStorage_.get('MyRestIPPort'), // '0000'
])
.then(([val1, val2]) => {
this.MyRestIPAddress = val1;
this.MyIPPort = val2;
return [val1, val2];
})
);
GetRestAddress() {
return this.GetDataFromStorage.subscribe(([val1, val2]) => { // 'localhost','0000'
let RestAddress = 'http://' + val1 + ':' + val2 + '/rest/';
console.log(RestAddress);
return RestAddress; // 'http://localhost:0000/rest/'
});
}
たMyService
-thanks
getStoresSummaryResults(): Observable<MyTypeClass> {
let MyConfig: MyAddressConfig;
MyConfig = new MyAddressConfig(this.ionicStorage_);
return this.http_.get(MyConfig.GetRestAddress() + 'my/path?&tst=1')
.map(res => res.json())
.catch(this.handleError);
}
おかげさまで大変感謝しています。 –