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/

posted on 2017-08-08 13:22  前路亦是故乡  阅读(177)  评论(0编辑  收藏  举报

导航