title: Form validation in angularjs (ionic) doesn't work for me
body: <p><strong>What do I want to achieve?</strong></p>
  
  <p>I have a form with inputs that have certain types and that are required. Whenever a user clicks 'submit' I want to check whether the form passes validation or not. </p>
  
  <p>This is the bare-minimum demo to show how far I got everything to work: <a href="http://jsbin.com/gokewosoti/13/edit" rel="nofollow">http://jsbin.com/gokewosoti/13/edit</a> (updated with solution)</p>
  
  <p>I created the submit handler called <code>doForm</code> that handles the click event on the submit button.
  Inside I have access to the variable <code>theForm</code> (the form's name). </p>
  
  <p>According to some sources (<a href="http://blog.brunoscopelliti.com/form-validation-the-angularjs-way" rel="nofollow">http://blog.brunoscopelliti.com/form-validation-the-angularjs-way</a>) I should be able to do <code>theForm.$valid</code> and get a boolean showing if the form is valid or not. This turns out not to work.</p>
  
  <p>It does work when I run some cumbersome code:
  <code>formy = angular.element(theForm).scope().theForm</code>
  Then suddenly <code>formy.$valid</code> works. </p>
  
  <p>What am I doing wrong?</p>
  
  <h2>Update (solved)</h2>
  
  <p>The solution thanks to marked answer: <a href="http://jsbin.com/gokewosoti/14/edit" rel="nofollow">http://jsbin.com/gokewosoti/14/edit</a></p>