These are chat archives for angular-ui/ui-select

23rd
Jan 2015
pjc2007
@pjc2007
Jan 23 2015 03:01

Hi, I am newish to ui-select and angular. I've been looking for a searchable combo and this ui-select seems to be just what I am after. To use it, I wanted to be able to wrap it into another reusable directive, where I can pass the list of options (and optionally selectedItem). Something like

'code'
.directive('searchcombo', function () {
var directive = {};
directive.scope = {
selecteditem: '@',
items: '@',
};

directive.template =
'<ui-select ng-model="items.selected" theme="select2" ng-disabled="disabled" style="min-width: 300px;">' +
'<ui-select-match placeholder="Select...">{{$select.selected.description}}</ui-select-match>' +
'<ui-select-choices repeat="item in items | propsFilter: {description: $select.search}">' +
'<div ng-bind-html="item.description | highlight: $select.search"></div>' +
'</ui-select-choices>' +
'</ui-select>';

return directive;
}) So it can then be used something like

<searchcombo items="[ { description: 'Adam', email: 'adam@email.com', age: 12, country: 'United States' }, { description: 'Amalie', email: 'amalie@email.com', age: 12, country: 'Australia' }]" >
</searchcombo>

When I try this, the items on this isolated scope are not found. Should it be possible to use the ui-select with such an isolated scope? Cheers

Chris Schmitz
@ccschmitz
Jan 23 2015 15:39
Having an issue in Chrome where spaces can't be entered in ui-select inputs. It works in Firefox, but that's the only other browser I've tested in. I'm using v0.9.6. Anyone have any ideas?
Austin
@amcdnl
Jan 23 2015 18:30
is there any trims or anything in there?
in the select code that might be treating it different
or maybe
" " is treated differently as falseys in FF vs Chrome
Shane Walters
@swalters
Jan 23 2015 19:12
I'm wrapping ui-Select in another directive so I can use it with ui-grid. I need ui-Select to use the same ng-model as my parent directive. This seems possible with a simple change in ui-Select directive to require '^ngModel' instead of 'ngModel'. Is there another way to do it today?
Chris Schmitz
@ccschmitz
Jan 23 2015 20:28
@amcdnl if I'm the only one experiencing this issue, it must be some competing JavaScript I have on the page. If anyone has any debugging tips I'd appreciate them :)