Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property 'concatMap' does not exist on type 'Observable<Object>'?

Tags:

angular

rxjs5

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

like image 486
xaisoft Avatar asked Jan 16 '18 17:01

xaisoft


2 Answers

Try importing this:

import 'rxjs/add/operator/concatMap'

like image 131
Lucas Tétreault Avatar answered Nov 13 '22 06:11

Lucas Tétreault


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))
    );
  }
like image 25
jrelo Avatar answered Nov 13 '22 07:11

jrelo