Observable.of is not a function

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

    I had this problem today. I'm using systemjs to load the dependencies.

    I was loading the Rxjs like this:

    ...
        paths: {
            "rxjs/*": "node_modules/rxjs/bundles/Rx.umd.min.js"
        },
    ...
    

    Instead of use paths use this:

    var map = {
    ...
    'rxjs':                       'node_modules/rxjs',
    ...
    }
    
    var packages = {
    ...
    'rxjs': { main: 'bundles/Rx.umd.min.js', defaultExtension: 'js' }
    ...
    }
    

    This little change in the way systemjs loads the library fixed my problem.

提交回复
热议问题