title: is it possible to do form validation in the submit handler?
body: <p>You can do form validatin using html in angular, but if you hit the <code>&lt;enter&gt;</code> key in an input field, the form gets submitted with all data being undefined (disabled button is ignored).</p>
  
  <p>How can I do form validation in the <code>ng-submit="submitForm()"</code> handler (where it belongs).</p>
  
  <p>Edit: so everyone is telling me that <code>enter</code> triggers the submit button to submit (and since its disabled it should work) -- I don't believe this to be true, but here's my form. For me it just submits when i hit enter.</p>
  
  <pre><code>&lt;form novalidate class="user" name="user" ng-show="showUserForm" ng-submit="joinChat()"&gt;
      &lt;input type="text" placeholder="Enter nick" required ng-model="user.nick" tabindex="1" ng-minlength="2" ng-maxlength="10"&gt;
      &lt;button ng-disabled="user.$invalid"&gt;Join&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here's what <code>joinChat()</code> does:</p>
  
  <pre><code>    $scope.joinChat = function(){
          $scope.showPostMessage = true;
          $scope.showUserForm = false;
  
          socket.emit('chat:join', { nick: $scope.user.nick });
      };
  </code></pre>