Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import { inject, InjectOptions, Type } from "@angular/core";
export class RootInjectorGuard {
option: InjectOptions = {
skipSelf: true,
optional: true
constructor(type: Type<any>) {
const parent = inject(type, this.option);
if (parent) {
throw Error(`[${}]: Can not create more than one instance`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment