Importing Module depending app in multiple apps Angular project

Discussão em 'Angular' iniciado por Lucas Weibel, Outubro 29, 2024.

  1. Lucas Weibel

    Lucas Weibel Guest

    I'm using a multiple apps Angular project with a .angular-cli.json like :

    "apps": [
    {
    "name": "app1",
    "root": "src",
    "outDir": "dist/app1",
    ...
    "main": "main.ts",
    },
    {
    "name": "app2",
    "root": "src",
    "outDir": "dist/app2",
    ...
    "main": "main.ts",
    }


    I created a module and would like to use it in one of the two apps. Is it possible to use the app value to conditionally import the module and personalize the component of just one of the two apps ?

    Something like

    @NgModule({
    imports: [ common modules ],
    if(app == app1) imports.add(specificModuleForApp1) ;


    and for the view

    <specific-component *ngIf="{app == app1}"> </specific-component>

    Continue reading...

Compartilhe esta Página