后台对接接口
// 获取选择功能
$scope.result = [];
$scope.select = function(id, event) {
console.log(event)
console.log(action)
var action = event.target;
if (action.checked) {
if ($scope.result.indexOf(id) == -1) {
$scope.result.push(id);
}
} else {
var idx = $scope.result.indexOf(id);
if (idx != -1) {
$scope.result.splice(idx, 1);
}
}
}
var permissions = []
for (var i = 0, len = info.length; i < len; i++) {
permissions.push(info[i].permissionId)
}
<div class="treecheck">
<ul>
<li>
<input type="checkbox" ng-click="select(1,$event)" id="1" ng-checked="select1" name="selected"> 首页
</li>
<li>
<input type="checkbox" ng-click="select(2,$event)" id="2" ng-checked="select2" name="selected"> 数据分析
</li>
......
</ul>
</div>
使用switch-case
$scope.oncheck = function(n) {
$log.log("ok oncheck?")
switch (n) {
case "1":
$scope.select1 = true;
$log.log("1ok")
$scope.result.push(1)
break;
case "2":
$scope.select2 = true;
$log.log("2ok")
$scope.result.push(2)
break;
.....
}
}
遍历权限并调用选取函数
for (i = 0, len = permissions.length; i < len; i++) {
$scope.oncheck(permissions[i])
$log.log(permissions[i])
}
由于默认的3000与我的服务有冲突 所以修改端口号为其他的
gulp.task('browserSync', function() {
browserSync.init({
// 路径
server: {
baseDir: './'
},
port: 3010//设置端口号
})
})
link: function(scope,element,attrs)
1)scope 与指令元素相关联的当前作用域 2)element 当前指令对应的元素,使用它可以操作该元素及其子元素 3)attrs 由当前元素的属性组成的对象
http://www.linuxidc.com/Linux/2016-09/134907.htm
shell备份mysql脚本:https://github.com/qidizi/linux-shells/blob/master/mysql-backup-by-root-crontab.sh