This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Mention import ordering in documentation #34
Closed
Description
Maybe this is basic Angular stuff we should know, but I think it would still be beneficial to add it to the docs. I was banging my head for a day and half trying to figure out why the in-memory backend wasn't being used.
My initial configuration was like
@NgModule({
imports: [
InMemoryWebApiModule.forRoot(...),
CoreModule.forRoot(), // imports HttpModule
// Material 2
MdIconModule.forRoot(), // also imports HttpModule -> I DIDN'T KNOW!!
})
class AppModule {}
It seems this ordering will cause the last added HttpModule
(with the default XHRBackend
) to be used instead of the InMemoryBackendService
. Changing the order to have the InMemoryWebApiModule
last did the trick.
I think it should be mentioned in the docs that we should make sure to place the module last, just in case.
Metadata
Metadata
Assignees
Labels
No labels