Skip to content

Unknown directive error inside ng-template or structural directive not detected with fullTemplateTypeCheck disabled #47601

Closed as not planned

Description

@ippeiukai

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

Yes

Description

I have a project where fullTemplateTypeCheck is disabled and FormsModule was accidentally dropped from imports.

Angular compiler did not complain NG8002: Can't bind to 'ngModel' since it isn't a known property errors. It turned out that all of our ngModel usage were either inside ng-template or conditioned with *ngIf. Removing *ngIfs for one of them recovered error detection for that element.

I recall Angular used to complain such issues anywhere upon AoT build, before the Ivy switch.

Please provide a link to a minimal reproduction of the bug

  • "fullTemplateTypeCheck: false" in tsconfig.json
  • remove FormsModule from NgModule's imports

error not detected (inside ng-template):

<ng-template>
  <!-- ... -->
  <input [(ngModel)]="name">
  <!-- ... -->
</ng-template>

error not detected (inside structural directive):

<div *ngIf="editing">
  <!-- ... -->
  <input [(ngModel)]="name">
  <!-- ... -->
</div >

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 13.3.7
Node: 14.19.1
Package Manager: npm 7.20.3
OS: darwin x64

Angular: 13.3.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.7
@angular-devkit/build-angular   13.3.7
@angular-devkit/core            13.3.7
@angular-devkit/schematics      13.3.7
@angular/cdk                    13.3.9
@angular/cli                    13.3.7
@angular/fire                   7.4.1
@schematics/angular             13.3.7
rxjs                            6.6.7
typescript                      4.6.4
webpack                         5.73.0

Anything else?

Probably related to #36171.

Activity

  1. JoostK commented on Oct 2, 2022

    @JoostK
    Member

    Yep, this is a duplicate of #36171.

  2. angular-automatic-lock-bot commented on Nov 2, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  3. locked and limited conversation to collaborators on Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions