Advertisement
Guest User

Untitled

a guest
Nov 11th, 2014
2,313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # UI-SELECT
  2. <ui-select on-select="clearCountries()" ng-model="customer.country_id" theme="bootstrap">
  3. <ui-select-match placeholder="Wpisz minimum 3 znaki...">{{$select.selected.name}}</ui-select-match>
  4. <ui-select-choices refresh="checkCountry($select.search)"  refresh-delay="500" repeat="country.id as country in countries | filter: $select.search">
  5. <div ng-bind-html="country.name | highlight: $select.search"></div>
  6. </ui-select-choices>
  7. </ui-select>
  8.  
  9. # CONTROLLER FUNCTION
  10. $scope.checkCountry = function(country_name){
  11.     if (country_name.length >= 3){
  12.       DataFactory.search('countries', country_name, 1, 20).then(function(result){
  13.           $scope.countries = result.plain()
  14.       })
  15.     }
  16.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement