title: AngularJS ng-submit fails on a Rails-generated form
body: <p>I'm working with a Rails server (with Devise for authentication) and an AngularJS client. I've added a form generated by Rails to my client-side page, adding the <code>ng-submit</code> Angular directive like so:</p>
  
  <pre class="lang-rb prettyprint-override"><code>&lt;%= form_for("user",
      :url =&gt; user_session_path,
      :html =&gt; { "ng-submit" =&gt; "doSignIn()" }) do |f| %&gt;
  </code></pre>
  
  <p>This generates a form with both <code>action</code> and <code>ng-submit</code> attributes, like this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form accept-charset="UTF-8" action="/users/sign_in" method="post" ng-submit="doSignIn()"&gt;
  </code></pre>
  
  <p>In the definition of the controller in the enclosing <code>div</code>, I have a <code>doSignIn</code> function that doesn't do anything at the moment:</p>
  
  <pre class="lang-js prettyprint-override"><code>$scope.doSignIn = function() {
      console.log($scope.email, $scope.password);
  };
  </code></pre>
  
  <p><code>$scope.email</code> and <code>$scope.password</code> are bound using <code>ng-model</code>. Or, at least, they're supposed to be - I can't tell, because clicking on submit always results in being directed to <code>/users/sign_in</code>. I was under the impression that using <code>ng-submit</code> would prevent the form from redirecting the user. I have also tried adding an <code>ng-click</code> to the submit button, using the same method, which also uses the <code>doSignIn()</code> method, and I've even tried passing it the event and calling <code>event.preventDefault()</code>. Nothing seems to stop me being redirected.</p>
  
  <p>My goal is eventually to perform sign-in with AJAX, but for now, just proving that I can stop the automatic redirect would be great!</p>