title: How can I detect keydown or keypress event in angular.js?
body: <p>I'm trying to get the value of a mobile number textbox to validate its input value using angular.js. I'm a newbie in using angular.js and not so sure how to implement those events and put some javascript to validate or manipulate the form inputs on my html code.</p>
  
  <p>This is my HTML:</p>
  
  <pre><code>    &lt;div&gt;
          &lt;label for="mobile_number"&gt;Mobile Number&lt;/label&gt;
          &lt;input type="text" id="mobile_number" placeholder="+639178983214" required
             ngcontroller="RegisterDataController" ng-keydown="keydown"&gt;
      &lt;/div&gt; 
  </code></pre>
  
  <p>And my controller:</p>
  
  <pre><code>    function RegisterDataController($scope, $element) {
         console.log('register data controller');
         console.log($element);
         $scope.keydown = function(keyEvent) {
          console.log('keydown -'+keyEvent);
         };
      }
  </code></pre>
  
  <p>I'm not sure how to use the keydown event in angular.js, I also searched how to properly use it. And can i validate my inputs on the directives? Or should I use a controller like what I've done to use the events like keydown or keypress?</p>