title: Angular UI - Bind and unbind for keypress
body: <p>I want to bind/unbind the keypress when user clicks to the checkbox. I tried to code a bit but not work at all without error in javascript console.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;textarea name="message" ng-model="message" ui-keypress="btnEnter"&gt;&lt;/textarea&gt;
  &lt;input type="checkbox" ng-click="bindKeyEnter($event)"&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>function MyCtrl($scope) {
       $scope.btnEnter = {};
  
       $scope.bindKeyEnter = function(e) {
           var checkbox = e.target;
           $scope.btnEnter = checkbox.checked ? {enter: 'sendMessage()'} : {}
       };
  
       $scope.sendMessage = function() { console.log($scope.message); }
  }
  </code></pre>
  
  <p>Your suggestion?</p>