title: Detect unsaved data using angularjs
body: <p>I'm a newbie to AngularJs, so this might be trivial.
  Are there any inbuilt AngularJs <code>directive</code> to detect unsaved data in a form.
  If not then how to go about writing one.
  Any pointers would be appreciated.</p>
  
  <p>html code is </p>
  
  <pre><code>&lt;input type="text" runat="server" /&gt;
  </code></pre>
  
  <p>And my angular js controller code is</p>
  
  <pre><code>    function MyCtrl1($scope) {
        // code to do stuff
  }MyCtrl1.$inject = ['$scope'];
  </code></pre>
  
  <p>I am trying to write a directive to detect unsaved data, and I'm guessing its to be written in the above controller.Correct me if wrong.</p>