Skip to content

Feature Request: Migration for ngClass and ngStyle to class and style #61661

Closed as not planned
Closed as not planned

Description

@Ash-Codez

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

https://next.angular.dev/style-guide#prefer-class-and-style-over-ngclass-and-ngstyle

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.

Activity

  1. added
    area: core
    area: migrations
    on May 26, 2025
  2. added this to the needsTriage milestone on May 26, 2025
  3. pkozlowski-opensource commented on May 28, 2025

    @pkozlowski-opensource
    Member

    Related: #45734 and #40623

  4. JeanMeche commented on May 28, 2025

    @JeanMeche
    Member

    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.

  5. Ash-Codez commented on May 28, 2025

    @Ash-Codez
    Author

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

  6. AnkitaSood commented on Jun 12, 2025

    @AnkitaSood
    Contributor

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

  7. JeanMeche commented on Jun 12, 2025

    @JeanMeche
    Member

    Yeah we should have that information somewhere, probably in the guides. We even have an issue for that #40623.

  8. 16 remaining items

  9. JeanMeche commented on Aug 29, 2025

    @JeanMeche
    Member

    We've landed an ngClass migration with #62983. It'll be available in v21.

  10. angular-automatic-lock-bot commented on Sep 29, 2025

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

  11. locked and limited conversation to collaborators on Sep 29, 2025
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

    area: corearea: migrationscore: styling bindings

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions