angular.js - In angularjs, select the checkbox and add a classname to its upper level, uncheck to remove the classname
巴扎黑2017-05-15 16:53:17
0
2
772
When the check box is selected, a classname is added to li. When it is deselected, the classname of li is removed
I’ve been searching for a long time but haven’t found a good way to operate the dom
Use ng-class
ng-class="{'className':value}"
When value is true, className style will be applied
If you use
class
,最好给li
一个ng-class
,<li ng-class="{true: 'clasname'}[checked == true]" ></li>
~