2

Just started learning angular development. Following official angular doc from angular.io. Everything was working fine step by step till I reach https://angular.io/tutorial/toh-pt6

Added HttpClientInMemoryWebApiModule for mocking remote server, now it's not working.

here is browser console logs: enter image description here

It's now able to find out 'api/heroes' endpoint. this may be configuration issue with 'HttpClientInMemoryWebApiModule'.

Here is my source code: https://github.com/csankhala/angular-tour-of-heroes

Please let me know what I missed?

c.sankhala
  • 850
  • 13
  • 27

1 Answers1

2

Your urls must matchs the name of your data declared inside the in-memory-data.service.

In this situation, in order to query api/heroes, the createDb() function returned object must include a variable named heroes (rather than HEROES).

Gérôme Grignon
  • 3,859
  • 1
  • 6
  • 18
  • i had the same problem but my variable was correctly named heroes. my problem was i had "return heroes;" instead of "return {heroes};" in the createDb() function. just adding this here in case of anyone having the same problem as me – Molbac Jan 09 '23 at 12:20