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
Try importing this:
import 'rxjs/add/operator/concatMap'
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))
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With