title: Pass $dirty flag from child form in directive to parent form
body: <p>I am new to angular JS. I have main form it has text box and one directive which has checkboxes. If user addded some text to textbox or modify inital status of checkboxes, when user click on ok button I have to check dirty flag and prompt user for unsaved changes. This is my <a href="http://plnkr.co/edit/S4zhLMqiEAwCfoq6mRdx?p=preview" rel="nofollow">plunk</a>.<br>
  I have to use angular 1.3.16 version.
  <strong>script.js:</strong></p>
  
  <pre><code>// Code goes here
  (function() {
    "Use Strict";
  
  
    angular.module('myapp', []);
  
    angular.module('myapp').
    controller('myappctrl', function($scope) {
  
      $scope.user = {
        list: [{
          id: 1,
          value: 'chkbox1',
          selectedReturnType: false
        }, {
          id: 2,
          value: 'chkbox2',
          selectedReturnType: true
        }, {
          id: 3,
          value: 'chkbox3',
          selectedReturnType: false
        }, {
          id: 4,
          value: 'chkbox4',
          selectedReturnType: true
        }, ]
      };
  
      $scope.ok = function() {
        if ($scope.mainform.$dirty) {
          alert('form modified');
        }
      };
    });
  
  
  
  
    angular.module('myapp').directive('checkboxdir', function() {
      return {
        templateUrl: "checkboxdir.html",
        restrict: 'EA',
        scope: {
          user: '='
        }
      }
    });
  
  
  }());
  </code></pre>
  
  <p><strong>Index.html:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html ng-app="myapp"&gt;
  
    &lt;head&gt;
      &lt;link rel="stylesheet" href="style.css" /&gt;
       &lt;script data-require="jquery@*" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"&gt;&lt;/script&gt;
      &lt;script data-require="angular.js@1.3.16" data-semver="1.3.16" src="https://code.angularjs.org/1.3.16/angular.js"&gt;&lt;/script&gt;
  
      &lt;script src="script.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
  
    &lt;body  ng-controller="myappctrl"&gt;
      &lt;form name="mainform" novalidate&gt;
      &lt;checkboxdir user='user'&gt;&lt;/checkboxdir&gt;
      &lt;input type="text" /&gt;
      &lt;input type="button" value="ok" ng-click="ok()"/&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Directive:</strong></p>
  
  <pre><code>&lt;div&gt;
    &lt;form name='returntypeform' novalidate&gt;
      &lt;div ng-repeat='item in user.list'&gt;
      &lt;input type='checkbox' ng-checked="item.selectedReturnType" /&gt;
      &lt;label&gt;{{item.value}}&lt;/label&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Need to pass checkbox check/uncheck from child directive to parent. Any idea why this is not working?</p>