84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
angularjs中ng-class和class到底有什么区别,怎么用ng-class呢
ng-class sets the class based on key: value
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.
ng-class sets the class based on key: value
I did a project today and found that there is another way to write, which cannot be learned from books.
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.