when I execute my angular application locally, this error occurred suddenly even without doing any code changes while the same code base can be run in a separate machine with the same configuration.
ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(AppModule)[ActivatedRoute -> ActivatedRoute -> ActivatedRoute]: NullInjectorError: No provider for ActivatedRoute!
Try to add the following import in AppModule file
imports: [
RouterModule.forRoot([]),
...
],
To import RouterModule you should do something like this:
import { RouterModule } from '@angular/router';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With