pradeep
pradeep

Reputation: 176

AngularJS 1.4.1 and angular UI bootstrap 0.13.0, ng-class with object property

I have the following code,

<accordion-group ng-class={selected : object.property}></accordion-group>
<input type="button" ng-click="object.property=!object.property">

When I run the above code, on load of application, object.property is true and the css is applied. On click of button, css property is removed. On click of button again, css is not getting applied.

Note: This worked with the previous versions of angular and bootstrap. I recently got upgraded to angular1.4.1 and bootstrap 0.13.0. I suspect this is because of latest version update, but, could not find a valid documentation for me to conclude.

Thanks in advance.

Upvotes: 0

Views: 124

Answers (1)

BAD_SEED
BAD_SEED

Reputation: 5056

<input type="button" ng-click="object.property = !object.property">

And I prefear ng-class like this:

ng-class="{'selected' : property}"

since on the left part of the : operator there will be surely a string!

And here is a PLNKR.

Upvotes: 1

Related Questions