angular-ui-switch

代码:https://codepen.io/anon/pen/gxmWzB

github: https://github.com/xpepermint/angular-ui-switch

功能类似于bootstrap的switch功能,由于数据绑定的存在,不使用对象中的方法切换,改用watch监听model绑定的值(示例中的enabled),

  状态切换触发的函数在监听器中实现

var viewTypeWatcher = $scope.$watch('enabled',function(newValue,oldValue,scope){
         if(newValue === true&&typeof newValue != 'undefined'){
             $scope.getPersonList(2,0);
         }else if(newValue === false&&typeof newValue != 'undefined'){
             $scope.personReach(2,0)
         }
     })

angular-ui-bootstrap demo地址:http://angular-ui.github.io/bootstrap/

开黑吗我亚索贼6
原文地址:https://www.cnblogs.com/insight0912/p/7306336.html