Reputation: 3451
I upgraded from Angular 4 to 5 and replaced Http
with HttpClient
. I removed chained map from my http.post
call which now returns an Observable<Object>
, but in my component it is now complaining that concatMap does not exist on type Observable<Object>
. Here is an example of what I am doing:
//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));
}
I can see map and mergeMap on Observable<Object>
but not concatMap
Upvotes: 5
Views: 8184
Reputation: 238
You need use pipe
registerDomain(caseId,domain) {
return this._domainService.registerDomain(caseId,domain)
.pipe(
concatMap(operation => this.getOperationDetail(operation.OperationId,this.caseId,domain))
concatMap(() => this.createRecordSets(domain))
);
}
Upvotes: 5
Reputation: 953
Try importing this:
import 'rxjs/add/operator/concatMap'
Upvotes: 10