Angular Typeahead Example

Cole Cammack, over 1 year ago

To begin, make sure these are loaded into your app:

  <script src=""></script>
  <script src=""></script>
  <script src="example.js"></script>
  <link href="//" rel="stylesheet">

Then, in the HTML place this:

<input class="form-control" type="text" ng-model="result" typeahead="suggestion as for suggestion in providers($viewValue)">

The naming here is important. "result" and "suggestion" are preconfigured by bootstrap. All you are changing here is the ".name" and "providers"

Then in your Angular Controller:

$scope.providers = function(providerName) {{}, {
    q: {s: {}, name_cont: providerName},
    page: 1
  }, function(res, headers) {
    $scope.providers_response = res
  }), function(err) {

  return $scope.providers_response;


As you type, this action is returning your responses. Finally, back in the HTML, grab what you are wanting to save. You will use the "result" object.

<input ng-model="service.provider_id" value="{{}}" hidden>