Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <select ng-model="filtro.galpao" chosen id="BuscarGalpaoId">
- <option selected="selected" value="">Selecione um Galpão</option>
- <option ng-repeat="galpao in selectList.galpoes"
- ng-class="{
- incompleto: galpao.situacao === 'incompleto',
- completo: galpao.situacao === 'completo',
- vazio: galpao.situacao === 'vazio',
- inativo: galpao.situacao === 'inativo'
- }" value="{{galpao.id}}">{{galpao.descricao}}
- </option>
- </select>
- app.directive('chosen', function ($timeout) {
- var linker = function (scope, elemen, attrs) {
- // update the select when data is loaded
- scope.$watch(attrs.select2, function (oldVal, newVal) {
- $timeout(function () {
- elemen.trigger('change');
- }, 100);
- });
- // update the select when the model changes
- scope.$watch(attrs.ngModel, function () {
- $timeout(function () {
- elemen.trigger('change');
- }, 100);
- });
- angular.element(elemen).select2({width: '100%'});
- };
- return {
- restrict: 'A',
- link: linker
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement