Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nested square brackets don't work when binding classes to elements #62093

Closed as duplicate of#61671
@drakedeatonuk

Description

@drakedeatonuk

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

core

Is this a regression?

No

Description

In Angular 20 using a tailwind utility classes as an example:

This works:

<div [class.w-full]="true"></div>

This does not:

<div [class.w-[100%]]="true"></div>

The later is valid tailwind syntax, and given that binding classes with [class.something] is the recommended way to bind classes in templates over ngClass in Angular 20, it would be ideal if this syntax worked.

Without this you have to either fall back to [style.something], or keep using ngClass, neither of which are as clean as [class.something].

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


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

"@angular/core": "20.0.3"
"typescript": "5.8.2"

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions