Map doesn't exist on Observable<Object> with angular 6.0.0 and rxjs 6.1.0

前端 未结 7 711
情歌与酒
情歌与酒 2020-12-29 07:46

Hi I\'m trying to follow a tutorial on angular but the tutorial was made in September. I believe the person used angular-cli 1.3.2. I\'m not sure which version of rxjs he wa

7条回答
  •  粉色の甜心
    2020-12-29 08:01

    The Angular new version actually does not support .map. A few changes have been done in the new angular version. You can check on these by visiting the angular website, but here is a solution of these problems; run these commands in cmd destination of your project:

     npm install --save rxjs-compat
    

    and enjoy with old technique, but don't forget to add these lines in shared service:

    import { Observable, Subject } from 'rxjs';
    import 'rxjs/add/operator/map'; 
    import 'rxjs/add/operator/catch';
    

提交回复
热议问题