Advertisement
Guest User

Bootstrap Typeahead

a guest
Sep 18th, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <label data-translate="company"></label>
  2. <input type="text" ng-model="newItem.company" placeholder="Kód, alebo Názov" uib-typeahead="company for company in getCompanies($viewValue)" typeahead-loading="loadingLocations" typeahead-no-results="noResults" class="form-control" typeahead-input-formatter="formatLabel($model)">
  3. <i ng-show="loadingLocations" class="glyphicon glyphicon-refresh"></i>
  4. <div ng-show="noResults">
  5. <i class="glyphicon glyphicon-remove"></i> No Results Found
  6. </div>
  7.  
  8.  
  9.  
  10. $scope.getCompanies = function(val, val2) {
  11.     return $http.get(appConfig.apiUrl.crmCompaniesGet + '?search=' + val, {
  12.         params: {
  13.             company: val,
  14.             sensor: false
  15.         }
  16.     }).then(function(response){
  17.         console.log(response);
  18.         return response.data.results.map(function(item){
  19.             console.log(item.title);
  20.             return item.title;
  21.         });
  22.     })
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement