|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en" ng-app="demo"> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>AngularJS ui-select</title> |
| 6 | + |
| 7 | + <!-- |
| 8 | + IE8 support, see AngularJS Internet Explorer Compatibility http://docs.angularjs.org/guide/ie |
| 9 | + For Firefox 3.6, you will also need to include jQuery and ECMAScript 5 shim |
| 10 | + --> |
| 11 | + <!--[if lt IE 9]> |
| 12 | + <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script> |
| 13 | + <script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.2.0/es5-shim.js"></script> |
| 14 | + <script> |
| 15 | + document.createElement('ui-select'); |
| 16 | + document.createElement('ui-select-match'); |
| 17 | + document.createElement('ui-select-choices'); |
| 18 | + </script> |
| 19 | + <![endif]--> |
| 20 | + |
| 21 | + <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.js"></script> |
| 22 | + <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular-sanitize.js"></script> |
| 23 | + <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.css"> |
| 24 | + |
| 25 | + <!-- ui-select files --> |
| 26 | + <script src="../dist/select.js"></script> |
| 27 | + <link rel="stylesheet" href="../dist/select.css"> |
| 28 | + |
| 29 | + <script src="demo.js"></script> |
| 30 | + |
| 31 | + <!-- Select2 theme --> |
| 32 | + <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2.css"> |
| 33 | + |
| 34 | + <!-- |
| 35 | + Selectize theme |
| 36 | + Less versions are available at https://github.com/brianreavis/selectize.js/tree/master/dist/less |
| 37 | + --> |
| 38 | + <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.8.5/css/selectize.default.css"> |
| 39 | + <!-- <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.8.5/css/selectize.bootstrap2.css"> --> |
| 40 | + <!-- <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.8.5/css/selectize.bootstrap3.css"> --> |
| 41 | + |
| 42 | + <style> |
| 43 | + body { |
| 44 | + padding: 15px; |
| 45 | + } |
| 46 | + |
| 47 | + .select2 > .select2-choice.ui-select-match { |
| 48 | + /* Because of the inclusion of Bootstrap */ |
| 49 | + height: 29px; |
| 50 | + } |
| 51 | + |
| 52 | + .selectize-control > .selectize-dropdown { |
| 53 | + top: 36px; |
| 54 | + } |
| 55 | + |
| 56 | + .container { |
| 57 | + height: 200px; |
| 58 | + overflow: hidden; |
| 59 | + border: 1px solid red; |
| 60 | + background-color: #fefefe; |
| 61 | + } |
| 62 | + </style> |
| 63 | +</head> |
| 64 | + |
| 65 | +<body ng-controller="DemoCtrl"> |
| 66 | + <script src="demo.js"></script> |
| 67 | + |
| 68 | + <button class="btn btn-default btn-xs" ng-click="enable()">Enable ui-select</button> |
| 69 | + <button class="btn btn-default btn-xs" ng-click="disable()">Disable ui-select</button> |
| 70 | + <button class="btn btn-default btn-xs" ng-click="clear()">Clear ng-model</button> |
| 71 | + |
| 72 | + <div class='container'> |
| 73 | + <h3>Select2 theme</h3> |
| 74 | + <p>Selected: {{person.selected}}</p> |
| 75 | + <ui-select ng-model="person.selected" theme="select2" ng-disabled="disabled" style="min-width: 300px;"> |
| 76 | + <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match> |
| 77 | + <ui-select-choices repeat="person in people | propsFilter: {name: $select.search, age: $select.search}"> |
| 78 | + <div ng-bind-html="person.name | highlight: $select.search"></div> |
| 79 | + <small> |
| 80 | + email: {{person.email}} |
| 81 | + age: <span ng-bind-html="''+person.age | highlight: $select.search"></span> |
| 82 | + </small> |
| 83 | + </ui-select-choices> |
| 84 | + </ui-select> |
| 85 | + </div> |
| 86 | + |
| 87 | +</body> |
| 88 | +</html> |
0 commit comments