亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

angular.js - What is the difference between ng-class and class in angularjs? How to use ng-class?
淡淡煙草味
淡淡煙草味 2017-05-15 17:02:47
0
3
863

What is the difference between ng-class and class in angularjs, and how to use ng-class

淡淡煙草味
淡淡煙草味

reply all(3)
PHPzhong

ng-class sets the class based on key: value

Ty80
function ctr($scope){
   $scope.test =“classname”;
}



<p class=”{{test}}”></p>



function Ctr($scope) { 
    $scope.isActive = true;
}



<p ng-class="{true: 'active', false: 'inactive'}[isActive]">
</p>



function Ctr($scope) { 

}



<p ng-class {'selected': isSelected, 'car': isCar}">
</p>


滿天的星座

I did a project today and found that there is another way to write, which cannot be learned from books.

ng-class="{'IM_selected':(status.currTalkTo.FRIENDID==item.FRIENDID)}"

This is the syntax of js, explained as follows: If status.currTalkTo.FRIENDID == item.FRIENDID is equivalent, IM_selected will be displayed, otherwise it will not be displayed. This syntax is often used in projects to obtain the current page.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template