-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Remove support for nested objects/arrays in ng-class #15960
Comments
Putting a side the specific way that this should be resolved, there are a few points that should be covered:
|
Angular 1.6.4 may not be representative of what this issue is trying to accomplish, but changing the example in my initial comment from
to
http://plnkr.co/edit/1kWniq?p=preview or to
http://plnkr.co/edit/4Qx1SN?p=preview makes it work. I'm guessing these changes turn my object into a string/boolean expression and This seems a little hacky and harder to read. It would be nice for this to continue working with the object syntax like it did before to keep my code consistent but I understand the importance of dropping this for performance and cleaning up the code. I feel like I'm still trying to get around these proposed nested object restrictions. My use case may not be widely used/needed. Idk if you guys have any better suggestions. Maybe this is just a bad practice and I should be going about it a different way. Writing a directive to work for both showing/hiding a class and showing/hiding an error message didn't seem as nice as just using |
@OzzieOrca I think all 3 of those examples should still be supported. But you're correct that the first one is broken in 1.6 because |
189461f caused an issue with nested literal objects/arrays in ng-class (#15905), essentially because it allowed the expression inputs (a watch optimization) to be used properly in the case of literals with interceptorFns.
Instead of reverting 189461f, or changing ng-class to use deep watch, or declaring its interceptor as
$stateful
- I'd like to drop nested object/array support fromng-class
. This will alignng-class
with the Angular version, should improve performance, should simplify the ng-class code a bit.This would be a breaking change in 1.7.
Any strong objections? Strong use cases for nested objects/arrays in ng-class?
The text was updated successfully, but these errors were encountered: