Jeanluca Scaljeri
Jeanluca Scaljeri

Reputation: 29107

Angular: one-time-binding for ngClass with multiple values

I would like to use one-time binding for the following situation

<div ng-class="{a: someValueA, b: someValueB}">....</div>

If I would like to use one-time binding for the whole expression I know you can do

<div ng-class="::{a: someValueA, b: someValueB}">....</div>

However, in my case I only want to use one-time binding just for one of the two. Lets assume that I only want to use one-time binding for someValueA, I've tried the following

<div ng-class="{a: ::someValueA, b: someValueB}">....</div>

or

<div ng-class="[::{a: someValueA}, {b: someValueB}]">....</div>

None of them work (errors) Any suggestions how to do this?

Upvotes: 3

Views: 364

Answers (0)

Related Questions