You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Migration for ngClass and ngStyle to class and style #61661
With the new style guide informing us to prefer class and style over ngClass and ngStyle, it does make sense and all our developers are now doing it for newer components.
It would also be great to have a migration which can change it for all the existing places.
Reacted by rubiesonthesky, Shuaib Hasan Akib, Bartosz Zygmunt, Harpush, Gerome Grignon and Ankita Sood
@JeanMeche Got it. I went through the threads mentioned above as well and understand that ngClass / ngStyle can't be gotten rid off completely.
I still think there should be a migration for this to do the covered cases atleast (and add on to it later on) because I rarely see people using ngClass / ngStyle for those uncovered cases, it's mostly the simple cases thats been used.
@JeanMeche It would be helpful to highlight the cases that can be handled with ngClass/ngStyle but not with class/style bindings in the style guide along with the recommendation.
Activity
pkozlowski-opensource commentedon May 28, 2025
Related: #45734 and #40623
JeanMeche commentedon May 28, 2025
TLDR of the issues mentionned by Pawel: the class/style bindings do not cover all the cases covered by ngClass/ngStyle directives.
It's actually a reason why we dediced to not deprecate the directives.
Ash-Codez commentedon May 28, 2025
@JeanMeche Got it. I went through the threads mentioned above as well and understand that ngClass / ngStyle can't be gotten rid off completely.
I still think there should be a migration for this to do the covered cases atleast (and add on to it later on) because I rarely see people using ngClass / ngStyle for those uncovered cases, it's mostly the simple cases thats been used.
AnkitaSood commentedon Jun 12, 2025
@JeanMeche It would be helpful to highlight the cases that can be handled with ngClass/ngStyle but not with class/style bindings in the style guide along with the recommendation.
JeanMeche commentedon Jun 12, 2025
Yeah we should have that information somewhere, probably in the guides. We even have an issue for that #40623.
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
16 remaining items
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class
feat(migrations): add migration to convert ngClass to use class (#62983)
JeanMeche commentedon Aug 29, 2025
We've landed an ngClass migration with #62983. It'll be available in v21.
angular-automatic-lock-bot commentedon Sep 29, 2025
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.
feat(schematics): extend ngclass-to-class migration to support string…
feat(schematics): extend ngclass-to-class migration to support string…