Angular 2 + angular-in-memory-web-api zone GET http://localhost:3000/traceur 404 (Not Found)

后端 未结 4 1019
野的像风
野的像风 2021-02-07 13:20

Hi I have a problem with angular-in-memory-web-api. I tried to use angular2-in-memory-web-api in SystemJS and another solutions her but with no result. I\'m using official quick

4条回答
  •  借酒劲吻你
    2021-02-07 13:48

    For some reason, I was still getting the same error even after following @joel's answer and the issue on github.

    In case if anyone is facing the same issue, follow the below steps:

    Add the below line to the "map" object in the systemjs.config.js file

    'angular-in-memory-web-api': 'node_modules/angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
    

    Essentially, here you are pointing to the umd.js file which is present in your node_modules folder.

    In the packages object of the systemjs.config.js file, add the below line

    'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
    

    These changes work only on versions greater than 0.1.13, Hence please verify in your package.json if "angular-in-memory-web-api" has a version greater than or equal to 0.1.13, i.e,

    "angular-in-memory-web-api": "~0.1.13", 
    

    Hope this helps!

提交回复
热议问题