I am using ngGrid
and in the process of customizing a cell template, I came across a situation where I would like to use ngClass
to create a dynamic class name as well as optionally add another class onto a single element.
I know that ngClass
can be used in multiple ways. The two I am interested in combining are as follows
<input type="text" data-ng-class="'colt' + col.index"/>
<input type="text" data-ng-class="{'error' : cptForm.$invalid}"/>
Is there anyway to combine these usages of ngClass
? Something like
<input type="text" data-ng-class="{'colt' + col.index: true, 'error' : cptForm.$invalid}"/>
Alternatively, I could create a method on my controller that does the work of creating both of these classes, but I would like to do the work in-line if I could.