javascriptangularjsangular-ui-bootstraptypeaheadangular-ui-typeahead

Angular UI bootstrap typeahead ng-model says null when clear the filed


The filter works very well, but unfortunately the {{filterlist.name}} says null once removed the typed text and also tables looks empty because of null

Demo: https://plnkr.co/edit/1QVdctw1hr4ggJOtFHUZ?p=preview

<input type="text" class="form-control" placeholder="Name" 
  ng-model="filterlist.name" 
  typeahead-editable="false" 
  uib-typeahead="person.name as person.name for person in expenses | filter:{name:$viewValue} | limitTo:8">

Solution

  • Check this Updated Plunk

    I think you missed to declare the filterlist in the controller

    $scope.filterlist = { name: '' };
    

    I have put the {{}} part at the top of the table just for readability. Not sure why it was an issue for you. Works in Chrome for me