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.


$scope.bySearch = function(descr){
      var xhr = $http({
        method: 'post',
        url: ''+descr
        $ =;


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

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…