Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
export function SOME_SERVICE_FACTORY(parentService: SomeService) {
return parentService || new SomeService();
}
@NgModule({
providers: [{
provide: SomeService,
deps: [[new Optional(), new SkipSelf(), SomeService]],
useFactory: SOME_SERVICE_FACTORY
}]
})
export class UiModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment