【发布时间】:2019-02-13 00:58:57
【问题描述】:
我正在尝试使用 ngx-soap 包通过 Angular 6 获取肥皂请求。 我有一个像这样处理 api 的服务:
import { Injectable } from '@angular/core';
@Injectable()
export class ApiService {
client: Client;
constructor(
private soap: NgxSoapService
) {
this.soap.createClient('assets/wsdl/auth/auth.wsdl').subscribe(client => this.client = client);
}
}
尽管这是包装页面上的确切示例,但我收到以下错误:
[ts] Property 'subscribe' does not exist on type 'Promise<Client>'.
我知道我可以使用 then 但不能使用这个包订阅吗?
【问题讨论】:
-
这个包的作者从 createClient 中删除了 observable 以支持 promise github.com/lula/ngx-soap/commit/… 应该可以订阅看看stackoverflow.com/questions/39319279/…