I have HeroMockService that will return mocked data and HeroService that will call back end service to retrieve heroes from database.
Assum
A great and simple solution is provided on this post by Luuk G.
https://hackernoon.com/conditional-module-imports-in-angular-518294aa4cc
In summary:
let dev = [
StoreDevtoolsModule.instrument({
maxAge: 10,
}),
];
// if production clear dev imports and set to prod mode
if (process.env.NODE_ENV === 'production') {
dev = [];
enableProdMode();
}
@NgModule({
bootstrap: [
Base,
],
declarations: [
Base,
],
imports: [
Home,
RouterModule.forRoot(routes, { useHash: true }),
StoreModule.forRoot(reducers.reducerToken),
...dev,
],
providers: [
],
})
export class Root { }