title: AngularJs Bootstrap typeahead detect event fired on enter key
body: <p>I have an angular bootstrap typeahead and the code is as given below.</p>
  
  <p>Html :</p>
  
  <pre><code>&lt;div class="col-sm-12 dlg-zero-margin-padding hide-last-result" align="left"&gt;
      &lt;input type="text" id="myInput" 
          ng-model="selected" 
          ng-keyup="myKeyUp(event,this.value)"
          typeahead="item for item in filterInput($viewValue)"
          typeahead-on-select='onSelect($item)'&gt;                       
  &lt;/div&gt;
  </code></pre>
  
  <p>My controller</p>
  
  <pre><code>$scope.myKeyUp(event, value) {
      debugger;
  }
  $scope.onSelect(event, value) {
      debugger;
  }
  </code></pre>
  
  <p>When mouse focus is on any of the typeahead options, my onSelect function is invoked regardless of mouse click or enter key press. I.E it is called whenever a selection is made. But I want to differentiate between a mouse click and enter key selection as I want to add some different flow in each case.</p>
  
  <p>How can I invoke 2 separate functions on enter key press and on mouse click. Or can I detect enter key press or a mouse click in my onSelect function?</p>
  
  <p>Please note : On keyup event(i.e myKeyUp()) does not fire when I press "enter". Only onSelect function gets invoked.</p>