Having some difficulty with 'MyAddressConfig' returning a string in my http.get
request. This function retrieves data from Ionic2 Storage, but I keep receiving
GET http://localhost:0000/[object%20Object]my/path?&tst=1 404 (Not Found)
Any suggestions on what might be causing this issue? -thanks
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
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);
}