12

InMemoryWebApiModule is working with downloaded source code where "angular-in-memory-web-api": "~0.5.0" But not with"angular-in-memory-web-api": "^0.6.0" I have followed the tutorial,to install angular-in-memory-web-api :

npm install angular-in-memory-web-api --save

And it installed "angular-in-memory-web-api": "^0.6.0"

Error Message:

webpack-internal:///./src/app/hero.service.ts:87 Object body: error: "Object(...) is not a function" __proto__: Object headers: HttpHeaders lazyInit: ƒ () lazyUpdate: null normalizedNames: Map(0) {} __proto__: Object status: 500statusText: "Internal Server Error" url: "api/heroes" __proto__: Object (anonymous) @ webpack-internal:///./src/app/hero.service.ts:87

2
  • If you would like help to resolve the issue, you are going to have to describe the actual issue. Doesn't work doesn't tell anything about the problem you are having. Commented Mar 23, 2018 at 21:45
  • That's is because v0.6.0 is meant to be matched against Angular 6, are you using NG6? If not, downgrade to v0.5.4 as suggested. Commented May 9, 2018 at 15:14

3 Answers 3

41

Looks like the 0.6.0 release of angular-in-memory-web-api has some breaking changes, which are likely out of sync with the versions of angular and rxjs that the tutorial has had you install.

Simplest fix is just to install the 0.5.4 version of angular-in-memory-web-api:

npm install [email protected] --save

Sign up to request clarification or add additional context in comments.

1 Comment

have same issue & it helps me lot
3

It was indeed an issue with the version of angular-in-memory-web-api.

I force installed v0.5.4 as zyzof suggested and it fixed it immediately! Thanks

npm install [email protected] --save

Comments

0

I was having the same issue and resolved it by uninstalling and installing again. I originally thought it was an authentication issue as I had used firebase to login anonymously with Angular but the tutorials I have used with the in memory-web-api previously were unauthenticated applications.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.