AngularJS + ngEnter

HTML

<script src="https://raw.github.com/timrwood/moment/1.7.2/min/moment.min.js"></script>
<div ng-app="miniapp">
  <div ng-controller="Ctrl">


    <form>
      <label ng-hide="editMode">Rashmi</label>
      <input ng-show="editMode" ng-enter="changemode()">
      <span class="pull-right">
           <button ng-click="editMode=true" class="btn-lg btn-warning"  >edit </button>                                       </span>
    </form>
  </div>

JavaScript

var $scope;
var app = angular.module('miniapp', []).filter('moment', function() {
  return function(dateString, format) {
    return moment(dateString).format(format);
  };
});

app.directive('ngEnter', function() {
  return function(scope, element, attrs) {
    element.bind("keydown keypress", function(event) {
      if (event.which === 13) {
        scope.$apply(function() {
          scope.$eval(attrs.ngEnter);
        });

        event.preventDefault();
      }
    });
  };
});

function Ctrl($scope) {
  $scope.changemode = function() {
    debugger;
    $scope.editMode = false;
  }
}