我在使用'MyAddressConfig'返回我的字符串时遇到了一些麻烦http.get
.它从Ionic2 Storage获取数据.问题是我一直在努力
GET http:// localhost:0000/[object%20Object] my/path?&tst = 1 404(Not Found)
有任何想法吗?-谢谢
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/'
});
}
Run Code Online (Sandbox Code Playgroud)
为MyService
getStoresSummaryResults(): Observable<MyTypeClass> {
let MyConfig: MyAddressConfig;
MyConfig = new MyAddressConfig(this.ionicStorage_); …
Run Code Online (Sandbox Code Playgroud)