Input type keypress event

Hi All,

I am try to call an event during keypress in one of the input box, but not sure how to pass the value of the input box.

This is how i do it and getting undefined in the end.

controller.js

$scope.bySearch = function(descr){
      var xhr = $http({
        method: 'post',
        url: 'http://www.webcentury.co.id/api/lists.php?descr='+descr
      });
     xhr.success(function(data){
        $scope.data = data.data;
      });
      $ionicScrollDelegate.scrollTop();
      console.log(descr);
}

sample.html

 <label class="item item-input">
         <i class="icon ion-search placeholder-icon"></i>
         <input type="text" ng-model="dash.search" placeholder="Search" ng-keypress="bySearch(dash.search)">
  </label>

What is the correct way to pass the data to angular?

u may use this way hope it help <input id="searchKey" type="search" autocapitalize="off" placeholder="Search" ng-model="search" autocorrect="off" ng-keypress="($event.which === 13)? discoverFilter(search):0">

Hi @Kusuma_12

How is it related to my controller?

can u please paste the code of controller…