Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NullInjectorError: No provider for e! in Angular 8

main-es2015.6f31d328c9edc909ac03.js:1 ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(i)[Se -> e]: StaticInjectorError(Platform: core)[Se -> e]: NullInjectorError: No provider for e!

I get the above error only when I do --prod build. FYI, the module is lazy loaded.

Any suggestions/help will be really appreciated.

like image 927
Shyam kumar Avatar asked Nov 06 '22 06:11

Shyam kumar


1 Answers

Remove all the services from providers as you already have added providedIn: 'root'

OR try this

@NgModule({
    providers: [
        MyService
    ]
})

You have to add your service in app.module.ts

like image 106
karthicvel Avatar answered Nov 15 '22 11:11

karthicvel