[AppInsightsService -> Router]: NullInjectorError: No provider for Router! (Angular 6)
See original GitHub issueI am currently updating my insights service to angular 6 and after the update when i try to run ng serve i get the message
Error: StaticInjectorError(InsightsModule)[AppInsightsService -> Router]:
StaticInjectorError(Platform: core)[AppInsightsService -> Router]:
NullInjectorError: No provider for Router!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:979)
at resolveToken (core.js:1232)
at tryResolveToken (core.js:1182)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
at resolveToken (core.js:1232)
at tryResolveToken (core.js:1182)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
at resolveNgModuleDep (core.js:9217)
at _createClass (core.js:9264)
at _createProviderInstance$1 (core.js:9234)
I’m not sure on what to do… everything was working fine with angular 5.2
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
No provider for router" while writing Karma-Jasmine unit test ...
You need to import RouterTestingModule when setting up the test module. /* tslint:disable:no-unused-variable */ import { async, ...
Read more >How To Use Angular Modules (Nullinjectorerror: No Provider ...
NullInjectorError : No provider for TodoService! ??? Im creating a custom module and import it into 2 routing modules.
Read more >NG0201: No provider for {token} found! - Angular
You see this error when you try to inject a service but have not declared a corresponding provider. A provider is a mapping...
Read more >Angular How-to: Add Application Insights to an Angular SPA
Note: @types are automatically included and no additional dependency is needed. "dependencies": { "@microsoft/applicationinsights-web": ...
Read more >No provider for router” while writing Karma-Jasmine unit test ...
component.spec.ts file: /* tslint:disable:no-unused-variable */ import { async, ComponentFixture, TestBed } from '@angular ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jondmcelroy i fixed that msg with RouterModule.forRoot([ { path: ‘’, component: AppInsightsService }, ]), on my app.module
Sorry for it taking a while to reply Mark… i “fixed” this error msg using
RouterModule.forRoot([ { path: '', component: AppInsightsService }, ]),
in my imports insights.module.ts yes i was using the latest version for angular 6 (the original idea was to package the app insights in a service pre configured so that a component could be created and used in other projects by just importing the service, after i applied this and i try to bootstrap the module it gives me a new error msg. [ERROR in Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.])