Angularjs - How to merge one bo-class with one ng-class using the lazy loading?

325 Views Asked by At

I am very confuse by the version 1.3+ of angularjs, before I was using bindonce and now we have the lazy loading with '::'.

I didn't find how I can bind only one class of a multiple ng-class.

This was my pevious code:

<a [...] bo-class="{'tuto': user.tutorial}" ng-class="{liked: liked == true}">[...]</a>

I need to use : ng-class"::{'tuto': user.tutorial}" and to keep my second ng-class.

How I can do to merge one bo-class using lazy loading with one ng-class which is bind ?

Thank you !

2

There are 2 best solutions below

1
On

Try to use this an ugly workaround.

<a 
  bo-attr 
  bo-attr-class="user.tutorial?'tuto':''" 
  ng-class="{liked: liked == true}">[...]</a>
1
On

for bo-class you can use:

bo-class="{'class1' : condition1,'class2' : condition2}"

and so on, basically you can have key value pairs that it will evaluate every pair.