Observable.of is not a function

后端 未结 19 684
旧时难觅i
旧时难觅i 2020-11-30 19:41

I am having issue with importing Observable.of function in my project. My Intellij sees everything. In my code I have:

import {Observable} from          


        
19条回答
  •  春和景丽
    2020-11-30 20:33

    RxJS 6

    When upgrading to version 6 of the RxJS library and not using the rxjs-compat package the following code

    import 'rxjs/add/observable/of';   
      // ...
      return Observable.of(res);
    

    has to be changed into

    import { of } from 'rxjs';
      // ...
      return of(res);
    

提交回复
热议问题