angularjs - How to add class name with the existing class name -
i getting classname
server red
,blue
or green
. trying add class element. nothing happening.
any 1 correct me please?
here try:
<span class="prostatus" ng-class="{activeapp.status}"> //class not adds {{activeapp.status}} //i getting `blue` here. </span>
just put as,
<span class="prostatus {{activeapp.status}}"> ...
or more efficiently
<span class="prostatus" ng-class="activeapp.status"> ....
here doc
it says can bind scope
value as,
$scope.classname = 'this-is-class-name'; <span class="prostatus" ng-class="classname">
why use { } in ng-class
if want apply css class based on condition below,
<span class="prostatus" ng-class="{ 'classname' : applyclass }">
css class classname
apply span
when applyclass
sets true
Comments
Post a Comment