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

ngClass bug in 1.2.16 #7639

Closed
Closed
@CesarAfonso

Description

@CesarAfonso

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/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions