Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ui-select ng-model="current_item" name="emitter" autocomplete="off" theme="select2" style="max-width:385px;">
- <ui-select-match placeholder="Select Item" title="{{$select.selected.name}}">{{$select.selected.name}}</ui-select-match>
- <ui-select-choices repeat="item in list" refresh="refresh($select.search)" refresh-delay="0">
- <small>{{item.name}}</small>
- </ui-select-choices>
- </ui-select>
- myApp.directive('mdOption',function(){
- return {
- restrict: 'E',
- priority: 0,
- require: [ '^^mdSelect', '^^ngModel'],
- link: function(scope, ele, attr, ctrls) {
- var repeatExpr = attr.ngRepeat;
- var optionsModelStr = repeatExpr.match(/[ ]+in+[ ]+(.*?)([ |]+)/)[1];
- var list = scope[optionsModelStr];
- var select = ctrls[0];
- var ngModel = ctrls[1];
- if (ngModel.$modelValue && list.indexOf(ngModel.$modelValue) < 0) {
- list.push(ngModel.$modelValue);
- }
- }
- }
- });
Add Comment
Please, Sign In to add comment