【发布时间】:2019-06-12 00:35:53
【问题描述】:
我正在尝试在我的 nativescript 应用程序上执行 http 请求,但是当调用 http.get() 时,我什么也得不到,没有错误,也没有调用 api。
servicos.component.ts
private servicos: Observable<Servico[]>;
constructor(
private servicosService: ServicosService
) {
// Use the component constructor to inject providers.
this.servicos = this.servicosService.listar();
}
ngOnInit(): void {
// Init your component properties here.
}
servicos.service.ts
@Injectable()
export class ServicosService{
constructor(private http: HttpClient){
}
listar(){
return this.http.get<any>(
CONSTANTS.SERVER_URL + '/servicos/'
);
}
}
【问题讨论】:
标签: nativescript nativescript-angular