I'm using the Yeoman aspnetcore-spa template with Angular 2.
There are essentially 3 key files involved:
- app.module.client.ts
- app.module.server.ts
- app.module.shared.ts
I have placed my Service in the providers section of app.module.client.ts
and then added my routing in app.module.shared.ts
. Initially, everything was working smoothly, and I could navigate without any issues. However, when I attempted to replace redirectTo
with my new path, things took a turn.
fail: Microsoft.AspNetCore.NodeService[0] blah bla Uncaught (in promise): Error: No provider for NameService!
The console started throwing errors, particularly when entering the page from localhost:5000
, along with some at injectionError
.
Changing redirectTo: 'home'
seemed to resolve the navigation issue, but enabling { useHash: true }
continued to flood the terminal with errors.
Although I attempted using the Router to navigate to my desired page in the HomeComponent
ngOnInit()
method, the problem persisted when entering the page from localhost:5000
. I have yet to explore the option of replacing HomeComponent
with my own component.
My main goal is to comprehend the underlying issue. Admittedly, I am relatively new to this specific template, as typically there is only one app.module.ts
file. There seems to be some hidden complexity within this template that I am struggling to grasp. Your guidance would be greatly appreciated!