Error: Can’t resolve ‘rxjs/add/operator/map’

There are some pretty heavy change in the use of rxjs 6.

Imports :

As already stated, you should now use :

import { map } from 'rxjs/operators';

(and same for other operators)

I want to mention here the other main changes :

Observable, Subject and methods that create Observables (like of) have now to be imported like that :

import { Observable, of, Subject } from 'rxjs';

You will need to use pipe to apply most operators, which might look a bit strange.

e.g. :

obs.pipe(
    map(....),
    secondOperator(....),
    thirdOperator()
)

instead of

obs.map(....)
   .secondOperator(....)
   .thirdOperator()

And finally, due to the change with pipe and conflict with JavaScript reserved words, some operators had to be renamed :

do becomes tap

catch and finally become catchError finalize

switch becomes switchAll

other functions were renamed as well :

fromPromise becomes from

throw becomes throwError

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)