Observable.of is not a function

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

    My silly mistake was that I forgot to add /add when requiring the observable.

    Was:

    import { Observable } from 'rxjs/Observable';
    import 'rxjs/observable/of';
    

    Which visually looks OK becasue rxjs/observable/of file, in fact, exists.

    Should be:

    import { Observable } from 'rxjs/Observable';
    import 'rxjs/add/observable/of';
    
    0 讨论(0)
提交回复
热议问题