Autocomplete like Outlook using typeahead and Angularjs -


i want create textbox utlise typeahead autocomplete of ui-angular, want autocomlementation works every time type key ";"for example: when type "anny" in textbox contact email address containing "anny" appears, select 1 want , when type key ";" can again use autocomlementation.(like outlook)... have created textbox works email address

<div class="form-group" ng-class="{'has-error':newrequest.beneficiaryid.$invalid}">      <label for="inputemail3" class="col-lg-2 control-label"> email:</label>      <div class="col-sm-10">          <input type="text" name="beneficiaryid"                  ng-model="ticket.beneficiaryid" placeholder="email"                  typeahead="address address.email address in form.autocomplete($viewvalue) | filter:$viewvalue"                  typeahead-loading=" loadinglocations"                  class="form-control" required>           <i ng-show="loadinglocations" class="glyphicon glyphicon-refresh"> </i>      </div> 

and that's service autocomplete

services.service('form', function ($http, $q, $modal) { this.autocomplete = function (val) {     var deferred = $q.defer();      $http.get("../api/employee/getautocomplet", {         params: {ssearch: val }     }).then(function (response) {          var addresses = [];         angular.foreach(response.data, function (item) {             addresses.push(item);         });         deferred.resolve(addresses);     });     return deferred.promise; }; 

what you're looking called "inline multiselect typeahead". popular non-angular implementations include chosen , select2. understand how various implementations work recommend viewing source , inspecting dom elements.

i've been meaning finish post here, details how works , how implement in angularjs. gist is:

  • bind keyboard strokes selecting item, e.g. enter, tab or ; in case
  • push item array of selected items
  • ngrepeat array , render inline list left of input, pushes input over
  • clear input content , keeping focus within it, allows keep typing more

you can angular implementation here , demo here.

ui-multiselect


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -