22< html ng-app ="app ">
33 < head >
44 < meta charset ="utf-8 ">
5- < title > ng-easy-infinite-scroll </ title >
5+ < title > ng-ui-multi-select </ title >
66 < link rel ="stylesheet " href ="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css " integrity ="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u " crossorigin ="anonymous ">
77 < link rel ="stylesheet " href ="dist/ng-ui-multi-select.css ">
88 </ head >
@@ -59,11 +59,16 @@ <h3>Importação do módulo:</h3>
5959
6060
6161 < div class ="row ">
62- < div class ="col-md-4 ">
62+ < div class ="col-md-12 ">
6363 < div class ="form-group ">
6464 < label > Funcionarios: </ label >
6565
66- < ui-multi-select placeholder ="Buscar... " ng-model ="funcionarios " close-on-select-item ="false " ng-disabled ="disabled ">
66+ < ui-multi-select placeholder ="Buscar... "
67+ ng-model ="funcionarios "
68+ close-on-select-item ="false "
69+ tagging ="addItem(value) "
70+ tagging-model ="items "
71+ ng-disabled ="disabled ">
6772 < ui-multi-select-item ng-repeat ="item in funcionarios " ng-value ="item ">
6873 {{item.nome}}
6974 </ ui-multi-select-item >
@@ -75,6 +80,7 @@ <h3>Importação do módulo:</h3>
7580 </ div >
7681
7782 </ div >
83+
7884 < div class ="col-md-8 ">
7985 < label > Model: </ label >
8086 < pre > {{funcionarios|json}}</ pre >
@@ -88,7 +94,9 @@ <h3>HTML</h3>
8894 <label>Funcionarios: </label>
8995 <ui-multi-select placeholder="Buscar..."
9096 close-on-select-item="false"
91- ng-model="funcionarios">
97+ ng-model="funcionarios"
98+ tagging="addItem(value)"
99+ tagging-model="items">
92100 <ui-multi-select-item ng-repeat="item in funcionarios"
93101 ng-value="item">
94102 {{item.nome}}
@@ -104,14 +112,19 @@ <h3>HTML</h3>
104112 < h3 > JavaScript</ h3 >
105113 < pre > < code style ="font-size: 10px; " class ="prettyprint "> angular.module('app', ['ngUiMultiSelect'])
106114.controller('ctrl', function($scope, $timeout){
107- $scope.selectedItems = [{"nome":"Mateus","idade":20}];
115+ $scope.selectedItems = [];
116+
108117 $scope.items = [
109118 { nome: 'Mateus', idade: 20},
110119 { nome: 'Thalita', idade: 19},
111120 { nome: 'Willian', idade: 25},
112121 { nome: 'Felipe', idade: 25},
113122 { nome: 'Munif', idade: 50}
114- ]
123+ ];
124+
125+ $scope.addItem = function(value){
126+ return { nome: value }
127+ };
115128})</ code > </ pre >
116129 </ div >
117130 </ div >
@@ -164,6 +177,22 @@ <h1>ui-multi-select</h1>
164177 [Boolean] - Atributo que decide se vai fechar ou não a caixa de opções.
165178 </ td >
166179 </ tr >
180+ < tr >
181+ < td >
182+ tagging
183+ </ td >
184+ < td >
185+ [Function] - Função que será executada ao teclar enter para adicionar objeto na lista.
186+ </ td >
187+ </ tr >
188+ < tr >
189+ < td >
190+ tagging-model
191+ </ td >
192+ < td >
193+ [Array] - Opções disponíveis para selecionar.
194+ </ td >
195+ </ tr >
167196 </ table >
168197 </ div >
169198 </ div >
@@ -254,13 +283,18 @@ <h1>ui-multi-select-option</h1>
254283
255284 $scope . funcionarios = [ ] ;
256285
286+ $scope . addItem = function ( value ) {
287+ return { nome : value }
288+ }
289+
257290 $scope . items = [
258291 { nome : 'Mateus' , idade : 20 } ,
259292 { nome : 'Thalita' , idade : 19 } ,
260293 { nome : 'Willian' , idade : 25 } ,
261294 { nome : 'Felipe' , idade : 25 } ,
262295 { nome : 'Munif' , idade : 50 }
263- ]
296+ ] ;
297+
264298 } )
265299 </ script >
266300
0 commit comments