title: How does angularjs detect $dirty when no form tag is used?
body: <p>I am using $window.addEventListener('beforeunload'... to detect whether changes have been made to a page, and it is working mostly as expected.  I'm also using $transitions.onStart... to detect when the back/forward browser buttons are used.  What I don't understand is how this is working, because my HTML template does not have any form tags in it, just inputs inside divs.  </p>
  
  <p>I have done research on this and cannot seem to find an answer, other than it is not necessary to use form tags in order to check the dirtiness of inputs.  I'm just not sure how this is actually working in the background.  </p>
  
  <pre><code>&lt;div class="modal-header bg-primary"&gt;
    &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
    &lt;h4 class="modal-title pull-left"&gt;New Note&lt;/h4&gt;
    &lt;div class="clearfix"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="modal-body"&gt;
    &lt;input type="textfield" ng-model="detailVM.newNoteContent"&gt;
    &lt;button ng-click="detailVM.addNewNote()"&gt;
      Save New Note &lt;span class="fa fa-check"&gt;&lt;/span&gt;
    &lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is my HTML code.  </p>
  
  <pre><code>        // For page reloads and attempts to leave the site
          $window.addEventListener('beforeunload', function (e) {
              // Cancel the event
              e.preventDefault();
              // Chrome requires returnValue to be set
              e.returnValue = '';
          });
  
          // For when a user hits the back button 
          $transitions.onStart({}, function ($transition)
          {
              var answer = confirm("Are you sure you want to leave this page? Changes you made may not be saved.")
              if (!answer) {
                  $transition.abort();
                  return false;
              }
              return true;
          });
  </code></pre>
  
  <p>And here is what I have in the controller.  </p>
  
  <p>When I enter data into the inputs and then attempt to reload, close, or click the back button, these show the message, "Are you sure you want to leave this page?" But how is it detecting that the inputs are dirty? </p>