Skip to content

Template error: Can't bind to 'ngIf' since it isn't a known property of 'h1/ng-container/div'. #32597

Closed

Description

@cromefire

🐞 bug report

Affected Package

I guess it's the @angular-devkit/build-angular

Is this a regression?

Yes, the previous version in which this bug was not present was: I guess somewhat around `8.1` or `8.2`

Description

If I use structural directives (at least *ngIf and I also got this with the forms module) combined with ivy and ng server (yarn start) the app works (so it's not an issue with CommonModule not being imported or similar). Then you need to change a thing in the template (just add text somewhere) and when ng serve reloads then it can't find the directive. This get resolved again if you restart ng serve

🔬 Minimal Reproduction

https://github.com/cromefire/ngIf-issue

🔥 Exception or Error

Template error: Can't bind to 'ngIf' since it isn't a known property of 'h1'.

or

Template error: Can't bind to 'ngIf' since it isn't a known property of 'ng-container'.

or

Template error: Can't bind to 'ngIf' since it isn't a known property of 'div'.

🌍 Your Environment

Angular Version:

Angular CLI: 8.3.3
Node: 12.10.0
OS: linux x64
Angular: 8.2.5
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.3
@angular-devkit/build-angular     0.803.3
@angular-devkit/build-optimizer   0.803.3
@angular-devkit/build-webpack     0.803.3
@angular-devkit/core              8.3.3
@angular-devkit/schematics        8.3.3
@angular/cli                      8.3.3
@ngtools/webpack                  8.3.3
@schematics/angular               8.3.3
@schematics/update                0.803.3
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?

Important:

  • ivy
  • ng serve

Activity

  1. JoostK commented on Sep 11, 2019

    @JoostK
    Member

    Hi @cromefire, thanks for testing Ivy!

    This looks like a duplicate of #32217, which has been fixed in #31932. For Ivy testing, please use the latest 9.0.0-next.5 preview release as any fixes related to Ivy are not backported into 8.x. If you experience other issues using the 9.0 preview, feel free to open new issue.

  2. cromefire commented on Sep 11, 2019

    @cromefire
    Author

    Do components already have support for 9.0?

  3. JoostK commented on Sep 11, 2019

    @JoostK
    Member

    @cromefire Not officially according to its peerDependencies, but it does work. In fact, the Angular framework repo runs the testcases from the components repo for each commit/PR, and vice versa does the components repo run against a nightly of Angular (therefore the 9.0 previews).

  4. angular-automatic-lock-bot commented on Oct 12, 2019

    @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.

  5. locked and limited conversation to collaborators on Oct 12, 2019
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