title: How to $setDirty input type=file field in Angularjs
body: <p>How to set dirty input type=file field in Angularjs ?</p>
  
  <p>I need to form be setted dirty if file is uploaded through input field and so submit button be enabled accordingly.</p>
  
  <p>Code below doesn't work.</p>
  
  <pre><code>&lt;form novalidate name="newForm" id="add-new-form" method="post" action=""&gt;
      ...
      &lt;input type="file" id="image_file" name="image_file" onchange="angular.element(this).scope().newForm.image_file.$setDirty()" accept="image/*"&gt;
      ...
      &lt;button type="button" class="btn btn-success" ng-disabled="newForm.$invalid || newForm.$pristine" id="add-new-btn" ng-click="update(product)"&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Save&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>