Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngClass bug in 1.2.16 #7639

Closed
CesarAfonso opened this issue May 30, 2014 · 3 comments
Closed

ngClass bug in 1.2.16 #7639

CesarAfonso opened this issue May 30, 2014 · 3 comments

Comments

@CesarAfonso
Copy link

Hi,

According to angularJS documentation, ngClass behaves like this :

1º - If the expression evaluates to a string, the string should be one or more space-delimited class names.
2º - If the expression evaluates to an array, each element of the array should be a string that is one or more space-delimited class names.
3º - If the expression evaluates to an object, then for each key-value pair of the object with a truthy value the corresponding key is used as a class name.

In the third scenario, until angular version 1.2.16, the scenario worked properly.
Ex in angular 1.2.15 : http://jsfiddle.net/greenhawk/bS4nV/

We have a class 'green', and we change the other classes based on a scope variable. So we could had 'green italic bold' or 'red italic bold'.

But this new version, 1.2.16, introduces an issue. In this version, the classes that are repeated in both scenarios are omitted. Like 'italic bold'. The ngClass only switches between red and green.
Ex in angular 1.2.16 : http://jsfiddle.net/greenhawk/kTrv3/

@caitp
Copy link
Contributor

caitp commented May 30, 2014

Hi, I believe this is a duplicate of #7135

@caitp
Copy link
Contributor

caitp commented May 30, 2014

There's a PR to fix this from @shahata in #7140 --- it would be good to +1 that PR =] Lets carry this over there

@caitp caitp closed this as completed May 30, 2014
@CesarAfonso
Copy link
Author

Ok, thank you for the quick answer. I didn't found the original issue, that's why I submit this issue.

I'll had a +1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants