nescalante / bonanza-ng

Angular autocomplete directive using bonanza

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bonanza ng

Angular autocomplete directive using Bonanza

Install

Use it as an npm package:

npm install bonanza-ng --save

Or just download it from bower

bower install bonanza-ng --save

Usage

Use it over an input

<input type="text"
   ng-model="owner"
   bonanza
   bonanza-request="getUsers($query)"
   bonanza-label="firstName + ' ' + lastName"
   bonanza-item-label="firstName + ' ' + lastName + ' (' + email + ')'"
   bonanza-on-select="ownerChanges = ownerChanges + 1"
   bonanza-is-loading="loadingUsers">

You will have to define in the controller a function for the request:

$scope.getUsers = function (query) {
  return usersResource
    .get(query)
    .$promise;
};

Ensure that the function returns a Promise.

License

MIT

About

Angular autocomplete directive using bonanza

License:MIT License


Languages

Language:JavaScript 99.5%Language:CSS 0.5%