Angular Module Skipself Constructor



    Jose Romero

    Angular TypeScript Recipes

    The code creates a new ModuleName object and sets its parentModule property to be the parentModule that was passed in as an argument. If the parentModule property is undefined, the code uses the AppModule as the parent module.

    Library: angular

    Shortcut: angular.constructor.skip.self

    constructor( @Optional() @SkipSelf() parentModule: ModuleName {
      if (parentModule) {
        const msg = `ModuleName has already been loaded. 
          Import ModuleName once, only, in the root AppModule.`;
        throw new Error(msg);
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.