Skip to content

Instantly share code, notes, and snippets.

Created February 10, 2019 13:02
What would you like to do?
import { Injector } from "@angular/core";
import { MessageTypeEnum } from "../model/message-type.enum";
import { LogService } from "../services/log.service";
import { ErrorService } from "../services/error.service";
import { TableService } from "../services/table.service";
import { Executioner } from "../model/executioner";
export class ServiceResolver {
static getService(message: MessageTypeEnum, injector: Injector): Executioner {
case MessageTypeEnum.ConsoleError:
return injector.get(ErrorService);
case MessageTypeEnum.ConsoleLog:
return injector.get(LogService);
case MessageTypeEnum.ConsoleTable:
return injector.get(TableService);
throw Error ('Service not found');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment