Observable.of is not a function

后端 未结 19 723
旧时难觅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:25

    If anybody is having this problem while using Angular 6/rxjs 6 see the answers here: Could not use Observable.of in RxJs 6 and Angular 6

    In short, you need to import it like this:

    import { of } from 'rxjs';
    

    And then instead of calling

    Observable.of(res);
    

    just use

    of(res);
    

提交回复
热议问题