Guest User

Untitled

a guest
Jan 17th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <ui-select ng-model="current_item" name="emitter" autocomplete="off" theme="select2" style="max-width:385px;">
  2. <ui-select-match placeholder="Select Item" title="{{$select.selected.name}}">{{$select.selected.name}}</ui-select-match>
  3. <ui-select-choices repeat="item in list" refresh="refresh($select.search)" refresh-delay="0">
  4. <small>{{item.name}}</small>
  5. </ui-select-choices>
  6. </ui-select>
  7.  
  8. myApp.directive('mdOption',function(){
  9. return {
  10. restrict: 'E',
  11. priority: 0,
  12. require: [ '^^mdSelect', '^^ngModel'],
  13. link: function(scope, ele, attr, ctrls) {
  14. var repeatExpr = attr.ngRepeat;
  15. var optionsModelStr = repeatExpr.match(/[ ]+in+[ ]+(.*?)([ |]+)/)[1];
  16. var list = scope[optionsModelStr];
  17. var select = ctrls[0];
  18. var ngModel = ctrls[1];
  19. if (ngModel.$modelValue && list.indexOf(ngModel.$modelValue) < 0) {
  20. list.push(ngModel.$modelValue);
  21. }
  22.  
  23. }
  24. }
  25. });
Add Comment
Please, Sign In to add comment