Angular not importing a module in app.module.ts still gives error in component declarations of...

Discussão em 'Angular' iniciado por Mahdi Zarei, Fevereiro 23, 2025.

  1. Mahdi Zarei

    Mahdi Zarei Guest

    I have an app that I want to extract two builds of it.

    First is a build that contains the whole app.

    Second one is an app that contains only one of my modules. And it has a separate routing module as well.

    I separated the builds using file replacement to define a new way of build in angular.json.

    Replacements are these:

    "fileReplacements": [
    {
    "replace": "projects/my-app/src/environments/environment.ts",
    "with": "projects/my-app/src/environments/environment.prod.ts"
    },
    {
    "replace": "projects/my-app/src/app/app.module.ts",
    "with": "projects/my-app/src/app/app-auth-standalone.module.ts"
    },
    {
    "replace": "projects/my-app/src/app/app-routing.module.ts",
    "with": "projects/my-app/src/app/app-auth-standalone-routing.module.ts"
    },
    {
    "replace": "projects/my-app/src/app/app.component.ts",
    "with": "projects/my-app/src/app/app-auth-standalone.component.ts"
    }
    ]


    Now when I run the ng run my-app:auth-standalone:production it gives me this kinds of errors:

    Error: <some-path>/message-bot.component.html:24:34 - error NG8002: Can't bind to 'control' since it isn't a known property of 'app-bot-view-tr
    ansfer-to-user'.
    1. If 'app-bot-view-transfer-to-user' is an Angular component and it has 'control' input, then verify that it is part of this module.
    2. If 'app-bot-view-transfer-to-user' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
    3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.


    If I don't import any of the modules or parent modules in the AppModule it will throw this kind of errors.

    I tried adding NO_ERRORS_SCHEMA and CUSTOM_ELEMENTS_SCHEMA in all modules but the errors still occur.

    Continue reading...

Compartilhe esta Página