Ionic2 应用程序错误:与服务器的连接不成功。(file:///android_asset/www/index.html)

Ionic2 应用程序错误:与服务器的连接不成功。(file:///android_asset/www/index.html),ionic2,Ionic2,从app.component.ts文件调用我的web服务时,我在VS Emulator for Android中运行应用程序时遇到以下错误。有人能提供一个解决方案吗 在app.component.ts的ngOnInit()生命周期钩子中,我正在访问web服务类中的数据 app.component.ts(节选) 下面是我在进行REST调用时的Web服务课程摘录: 我的移动数据服务(节选) public openWebMwthod():可观察{ 这是.initializeApp(); 让详细信息=

从app.component.ts文件调用我的web服务时,我在VS Emulator for Android中运行应用程序时遇到以下错误。有人能提供一个解决方案吗

在app.component.ts的ngOnInit()生命周期钩子中,我正在访问web服务类中的数据

app.component.ts(节选)

下面是我在进行REST调用时的Web服务课程摘录:

我的移动数据服务(节选)

public openWebMwthod():可观察{
这是.initializeApp();
让详细信息={
“EmpID”:this.sapId
};
让body=JSON.stringify(细节);
让标题=新标题(
{
“内容类型”:“应用程序/json”,
}
);
let options=newrequestoptions({headers:headers});
返回this.http.post(URL、正文、选项)
.map((res)=>res.json())
}

只需将此代码添加到config.xml

<preference name="loadUrlTimeoutValue" value="700000" />

public openWebMwthod() : Observable<any>{

    this.initializeApp();

    let details = {
                     "EmpID" : this.sapId
                   };

    let body = JSON.stringify(details);

    let headers = new Headers(
        {
          'Content-Type': 'application/json',    
        }
      );

    let options = new RequestOptions({headers:headers});

    return this.http.post(URL,body,options)
             .map( (res) => res.json())


  }
<preference name="loadUrlTimeoutValue" value="700000" />