Skip to content

Devitek/angular-livesearch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

angular-live-search

##Usage

Markup

<div ng-controller='MyController'>
<live-search id="search1" type="text"
  live-search-callback="mySearchCallback"
  live-search-item-template="{{result.city}}<strong>{{result.state}}</strong><b>{{result.country}}</b>"
  live-search-select="fullName"
  ng-model="search1" ></live-search>
</div>

Controller

//define app module with dependency
var app = angular.module("MyApp", ["LiveSearch"]);
app.controller("MyController", function($scope, $http, $q, $window) {
   $scope.search1 = "";
   //your search callback
   $scope.mySearchCallback = function () {
      var defer = $q.defer();
      defer.resolve([
        { city: "nailuva", state: "ce", country: "fiji"},
        { city: "suva", state: "ce", country: "fiji"}
      ]);
      return defer.promise;
   };
});

Example

Demo on Plunker

Working...

About

An angular directive for auto-completing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 92.5%
  • CSS 4.7%
  • Shell 2.4%
  • Ruby 0.4%