Created
February 22, 2018 21:27
-
-
Save msarsha/f8a7f9840e38abf7aaa1d11c1e2dada0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class NastyService { | |
constructor(@Inject(CASE_LOGIC_HANDLER) private caseHandlers: CaseLogicHandler[]) { | |
} | |
doNastyOperation(key: any) { | |
const handler = this.caseHandlers.find(h => h.key === key); | |
if (!handler) throw new Error(`No case handler provided for key: ${key}`); | |
handler.doLogic(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment