My router, which utilizes a resolver, is currently experiencing issues.
The error message reads:
Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[BlogResolver]: StaticInjectorError(Platform: core)[BlogResolver]: NullInjectorError: No provider for BlogResolver!
Here is the code for the resolver's function:
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<any> {
const id = route.params.id;
return this.service.findById(
}
This is how the router is defined:
{
path: 'blog/:id',
component: BlogpostComponent,
resolve: {
blogpost: BlogResolver,
},
I have never come across this error before and haven't been able to find a similar solution. Any assistance would be greatly appreciated.
Edit:
app.module
@NgModule({
declarations: [
AppComponent,
FooterComponent,
NavbarComponent,
HomeComponent,
NotFoundComponent,
],
imports: [
BrowserModule,
HttpClientModule,
FormsModule,
ReactiveFormsModule,
NgbModule,
AppRoutingModule,
MinhaEmpresaModule,
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
child module:
@NgModule({
declarations: [
AEmpresaComponent,
ComoChegarComponent,
TrabalheConoscoComponent,
BlogComponent,
BlogpostComponent,
],
imports: [
CommonModule,
ReactiveFormsModule,
AEmpresaRoutingModule,
NgbPaginationModule,
],
})