GeezerVison is showing github.com — feat(compiler): check that ng-container don't have class bindings by JeanMeche · Pull Request #70808 · angular/angular
Conversation
JeanMeche
commented
Sep 18, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Those are never applied and we should throw at compiler time.
class attributes are still supported because we allow them for content projection purposes.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
JeanMeche
changed the title
feat(compiler): check that ng-container don't class bindings
feat(compiler): check that ng-container don't have class bindings nor aria attributes
Sep 22, 2026
JeanMeche
changed the title
feat(compiler): check that ng-container don't have class bindings nor aria attributes
feat(compiler): check that ng-container don't have class bindings
Sep 23, 2026
Those are never applied and we should throw at compiler time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the partial linker re-parse templates? I wonder if adding this change without an exemption in the partial linker will cause breakages when parsing dependencies which still bind the class on ng-container
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
@@ -242,6 +242,11 @@ class HtmlAstToIvyAst implements html.Visitor { |
|
|
`Attribute bindings are not supported on ng-container. Use property bindings instead.`,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user wrote [attr.class]="foo" today, they'd get an error telling them to use [class]="foo", which would now also error. Maybe we can report these errors in a way that's a little more clear?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
);
|
|
|
} else if (
|
|
|
bound.type === BindingType.Class ||
|
|
|
(bound.type === BindingType.Property && bound.name === 'class')
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be breaking if a directive has a "class" input today?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
);
|
|
|
} else if (
|
|
|
bound.type === BindingType.Class ||
|
|
|
(bound.type === BindingType.Property && bound.name === 'class')
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also check if bound.name === 'style'?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
JeanMeche
added a commit
to JeanMeche/angular
that referenced
this pull request
Nov 7, 2026
This is the same change as angular#70808 but for g3 only due to its breaking nature.
|
This is one case of #71881. #71882 reports class bindings on <ng-container> as NG8031, along with style, event, and other bindings that <ng-container>, <ng-template>, and <ng-content> ignore. It runs in the type checker, so the linker concern doesn't apply, and it skips bindings a directive claims. #71884 makes it an error, like the TODO(v23) in #71844.
If both land, class bindings get the parse error and NG8031, so this needs reconciliation with #71882 and #71884 before merge.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|