属性 'concatMap' 在类型 'Observable<Object>' 上不存在?
Property 'concatMap' does not exist on type 'Observable<Object>'?
我从 Angular 4 升级到 5,并将 Http
替换为 HttpClient
。我从我的 http.post
调用中删除了链式映射,现在 returns 一个 Observable<Object>
,但在我的组件中它现在抱怨 concatMap does not exist on type Observable<Object>
。这是我正在做的一个例子:
//service
import { HttpClient} from '@angular/common/http';
constructor(private _http: HttpClient) { }
registerDomain()
{
return this._http.post('/api/domain/domain/register', {});
}
//component
registerDomain(caseId,domain) {
return this._domainService.registerDomain(caseId,domain)
.concatMap(operation => this.getOperationDetail(operation.OperationId,this.caseId,domain))
.concatMap(() => this.createRecordSets(domain));
}
我可以在 Observable<Object>
上看到 map 和 mergeMap 但在 concatMap
上看不到
你需要使用管道
registerDomain(caseId,domain) {
return this._domainService.registerDomain(caseId,domain)
.pipe(
concatMap(operation => this.getOperationDetail(operation.OperationId,this.caseId,domain))
concatMap(() => this.createRecordSets(domain))
);
}
尝试导入这个:
import 'rxjs/add/operator/concatMap'
我从 Angular 4 升级到 5,并将 Http
替换为 HttpClient
。我从我的 http.post
调用中删除了链式映射,现在 returns 一个 Observable<Object>
,但在我的组件中它现在抱怨 concatMap does not exist on type Observable<Object>
。这是我正在做的一个例子:
//service
import { HttpClient} from '@angular/common/http';
constructor(private _http: HttpClient) { }
registerDomain()
{
return this._http.post('/api/domain/domain/register', {});
}
//component
registerDomain(caseId,domain) {
return this._domainService.registerDomain(caseId,domain)
.concatMap(operation => this.getOperationDetail(operation.OperationId,this.caseId,domain))
.concatMap(() => this.createRecordSets(domain));
}
我可以在 Observable<Object>
上看到 map 和 mergeMap 但在 concatMap
你需要使用管道
registerDomain(caseId,domain) {
return this._domainService.registerDomain(caseId,domain)
.pipe(
concatMap(operation => this.getOperationDetail(operation.OperationId,this.caseId,domain))
concatMap(() => this.createRecordSets(domain))
);
}
尝试导入这个:
import 'rxjs/add/operator/concatMap'