-1

I've spent about 2 hours now trying to figure out what the issue is, but alas it's taking too long for what should be a tutorial. I've come to the step of "Get heroes with HttpClient" in the "6. Get Data from a Server" chapter of the official Angular tutorial. The code simply keeps on telling me "Http failure response for http://localhost:4200/api/albums:" (I've replaced "hero" with "album" in my code). Does anyone know what's the issue? Here's my code.

I've tried adding apiBase: 'api/' into

HttpClientInMemoryWebApiModule.forRoot(
      InMemoryDataService, { dataEncapsulation: false, apiBase: 'api/' }
    )
Gandeloft
  • 45
  • 8

1 Answers1

0

Ridiculous.

I've solved this by "reverse engineering" an answer to a not directly related question: https://stackoverflow.com/a/43119907/10299831

I've installed "angular-in-memory-web-api" inside of my project and now it works. I don't understand how it was already inported inside the code prior to me doing that install and there was no warning by the compiler, plus the code ran. All of that as a part of a tutorial I'm following. I don't know what is going on but it works now after I've installed that and re-run the project.

Gandeloft
  • 45
  • 8