I have HeroMockService that will return mocked data and HeroService that will call back end service to retrieve heroes from database.
Assum
Here's an example of the latest way to do it with conditional environment logic. Note that EventService and LogService are just examples of other services you may have).
providers: [
EventService,
LogService,
MyService,
{
provide: MyService,
useClass: (environment.custom == null || environment.custom === '' || environment.custom === 'MyCustomerService')
? MyCustomService : MyService
}
]
]