As I am build the APK with --prod I am getting the error below
ERROR Error: StaticInjectorError[e -> t]:
StaticInjectorError(Platform:
You are trying to use a service that is not listed in providers of your AppModule or inside you component.ts. Add the service to a providers list to make it work.
In app.modules if you want that service to be global (related to app context).
@NgModule({
declarations: [...],
imports: [...],
bootstrap: [...],
entryComponents: [...],
providers: [
MyService
]
})
Or in your component.ts if you want that service to be contextual to desired component.
@Component({
selector: '...',
templateUrl: '...',
providers: [MyService]
})
Do not add it in both files. Also don't forget to import that service when you inject it either in app.modules or component.
import { MyService } from '../services/myservice';
This question also may help you: Error: No provider for t