index.html
3 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<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="http://xn-static.oss-cn-hangzhou.aliyuncs.com/css/xn-bootstrap/1.0.1/bootstrap.min.css">
    <style>
        body{
            color: #333;
        }
        .xn-text-right{
            text-align: right;
        }
    </style>
</head>
<body ng-controller="MyController">
<div class="clearfix"></div>
<h3>例子</h3>
<div  style=" width: 250px;margin-left:500px">
    <div  zd-select-list   ng-model="seleceData"  data-method="getList(data)"   placeholder="请输入企业名"  data-callback="selectMethod(data)" > </div>
</div>
<div style="height: 50px">
    选择后的值:    {{seleceData}}
</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", ["zd.directive.select"])
        .controller("MyController", ["$scope","$timeout", function($scope,$timeout){
            $scope.getList=function(method){
                $timeout(function () {
                    var itemList=[
                        {name:"休闲运动男女鞋春夏秋凉鞋", id:1},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:2},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:3},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:4},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:5},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:6},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:7},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:8},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:9},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:11},
                        {name:"休闲运动男休闲鞋休闲运动男女鞋春夏秋凉鞋女鞋春夏秋凉鞋",  id:12},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:13},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:14},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:15},
                        {name:"休闲运动男女鞋春夏秋凉鞋",  id:22}
                    ];
                    /*数据请求完成后返回写法*/
                    method.deferred.resolve({itemList:itemList});
                },1000);
            };
            //选择框
            $scope.selectMethod=function (data) {
                alert("确定");
                console.log(data);
            }
        }]);
</script>
</html>