Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Factory function for creating a real service or a mock service
export function locationsServiceFactory() {
return (http: HttpClient, configService: AppConfigService, logging: LoggingService): LocationsService => {
if (configService.useFakeData) {
logging.logInfo('use mock service');
return new LocationsServiceMock();
} else {
logging.logInfo('use real service');
return new LocationsServiceImpl(http, configService);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.