both-list-select.html
2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<html ng-app="myApp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题</title>
<link href="../directive/style.css" rel="stylesheet">
<link rel="stylesheet" href="../spm_modules/xn-style-common/1.0.1/xn-style-common.less">
<link rel="stylesheet" href="../spm_modules/xn-icon-common/1.0.5/iconfont.css">
<link rel="stylesheet" href="../spm_modules/bootstrap-css/1.0.0/bootstrap.css">
</head>
<body ng-controller="MyController">
<div both-list-select data-select-data="users" ng-model="persons" select-title="人员"></div>
<div class="clearfix"></div>
<div both-tree-list-select data-select-data="usersTree" ng-model="result" name="nothing" ></div>
</body>
<script type="text/javascript" src="../spm_modules/jquery/1.7.2/jquery.js"></script>
<script type="text/javascript" src="../spm_modules/xn-angular/1.0.0/angular.js"></script>
<script type="text/javascript" src="../spm_modules/angular-ui/1.2.0/bootstraptpls.js"></script>
<script type="text/javascript" src="../directive/selects.js"></script>
<script type="text/javascript">
angular.module("myApp", ["xn.directive.select"])
.controller("MyController", ["$scope","$timeout","$sce", function($scope,$timeout,$sce){
$scope.init = function() {
$scope.users = [
{name:"Tom", id:"0"},
{name:"01Jason", id:"1", pId: "0"},
{name:"02Kitty", id:"2", pId: "0"},
{name:"011Jack", id:"3", pId: "1"},
{name:"021Jack", id:"4", pId: "2"},
{name:"022Jack", id:"5", pId: "2"},
{name:"03Jack", id:"6", pId: "1"}
];
$scope.usersTree = [
{name:"Tom", id:"0"},
{name:"01Jason", id:"1", pId: "0"},
{name:"02Kitty", id:"2", pId: "0"},
{name:"011Jack", id:"3", pId: "1"},
{name:"021Jack", id:"4", pId: "2"},
{name:"022Jack", id:"5", pId: "2"},
{name:"03Jack", id:"6", pId: "1"}
];
/* $scope.persons.push({name:"Tom", id:"0"});*/
};
$scope.init();
$timeout(function(){
/* $scope.result=[
{name:"Tom", id:"0"},
{name:"01Jason", id:"1", pId: "0"},
{name:"011Jack", id:"3", pId: "1"}
];*/
},1000);
}]);
</script>
</html>