Advertisement
Guest User

ui-select as directive

a guest
Aug 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Example 1:
  2. <ui-select  ng-model="eventRow[prStDe.dataElement.id]"
  3.                                                     theme="select2"
  4.                                                     ng-dblclick="$event.stopPropagation();"
  5.                                                     title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.displayName}}"
  6.                                                     ng-required={{prStDe.compulsory}}
  7.                                                     ng-disabled="selectedOrgUnit.closedStatus || selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
  8.                                                     name="{{eventRow.event}}{{prStDe.dataElement.id}}"
  9.                                                     on-select="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
  10.                                                     style="width:100%;">
  11.                                             <ui-select-match allow-clear="true" ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)' class="form-control-ui-select"  placeholder="{{'select_or_search' | translate}}">{{$select.selected.displayName  || $select.selected}}</ui-select-match>
  12.                                             <ui-select-choices  repeat="option.displayName as option in optionSets[prStDe.dataElement.optionSet.id].options | filter: $select.search | limitTo:maxOptionSize">
  13.                                               <span ng-bind-html="option.displayName | highlight: $select.search"></span>
  14.                                             </ui-select-choices>
  15.                                         </ui-select>
  16.  
  17. //Example 2:
  18. <ui-select  ng-model="selectedTei[attribute.id]"
  19.                                     theme="select2"
  20.                                     ng-required="attribute.mandatory"
  21.                                     name="foo"
  22.                                     d2-attribute-validator
  23.                                     attribute-data={{attribute}}
  24.                                     selected-program-id={{selectedProgram.id}}  
  25.                                     selected-tei-id={{selectedTei.trackedEntityInstance}}  
  26.                                     ng-disabled="selectedOrgUnit.closedStatus || isDisabled(attribute)"
  27.                                     on-select="teiValueUpdated(selectedTei, attribute.id)"
  28.                                     class="ui-select-style">
  29.                             <ui-select-match allow-clear="true"  class="form-control-ui-select"  placeholder="{{'select_or_search' | translate}}">{{$select.selected.displayName  || $select.selected}}</ui-select-match>
  30.                             <ui-select-choices  repeat="option.displayName as option in optionSets[attributesById[attribute.id].optionSet.id].options | filter: $select.search | limitTo:maxOptionSize">
  31.                               <span ng-bind-html="option.displayName | highlight: $select.search"></span>
  32.                             </ui-select-choices>
  33.                         </ui-select>
  34.  
  35. //Example 3:
  36. <ui-select ng-model="model.selectedProgram"
  37.                         theme="select2"
  38.                         on-select="getProgramAttributes(model.selectedProgram)"
  39.                         style="width:100%;">
  40.                     <ui-select-match allow-clear="true" class="form-control-ui-select" placeholder="{{'select_or_search' | translate}}">{{$select.selected.displayName  || $select.selected}}</ui-select-match>
  41.                     <ui-select-choices  repeat="program in programs | filter: $select.search | limitTo:maxOptionSize">
  42.                         <span ng-bind-html="program.displayName | highlight: $select.search"></span>
  43.                     </ui-select-choices>
  44.                 </ui-select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement