每当http请求(使用rxjs)由当时的真实设备创建,并且引用者接收到的服务为未定义。Ionic 3 http请求
它可以像预期的那样来自真实设备的http请求行为吗?
import { Injectable } from '@angular/core'; import { Http } from "@angular/http"; @Injectable() export class DbcallService { constructor(private _http: Http) { } getData() { var url = 'https://jsonplaceholder.typicode.com/posts'; this._http.get(url).subscribe(data => { console.log(data); }); } }
No.Can您展示'code'? – Sampath
其简单的rxjs获取请求。 – Nirav
它有多简单?如果您需要回答,则需要显示代码。请参阅以下内容:https://stackoverflow.com/help/how-to-ask – Sampath