both-list-select.html 2.51 KB
<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>