title: How to access AngularJS directive Form fields into parent controller
body: <p>I created following form as a angular directive and try to access the firstname from parent controller.
  Please help me or guide me how to access directive form fields from inside MainCtrl.</p>
  
  <p><strong>HTML</strong>
  </p>
  
  <pre><code> &lt;pre&gt;
        {{filter-frm| json}}
   &lt;/pre&gt; 
  
   &lt;div ng-controller="MainCtrl"&gt;
      &lt;userform&gt;&lt;/userform&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p><strong>JS</strong>
  </p>
  
  <pre><code>.controller('MainCtrl', ['$scope',  function($scope){
      console.log($scope.filterForm.firstname) //How to get this ?
  };
  
  .directive('userform', [function () {
      return {
          restrict: 'E',
          scope: { formCtrl: '=' }
          template: '&lt;div&gt;'
              + '&lt;form id="filterForm" ng-submit="login()"&gt;'
              + '&lt;input name="firstname" ng-model="user.firstName"&gt;'
              + '&lt;/form&gt; '
              + '&lt;/div&gt;',
          link: function (scope, element, iAttrs) {
              var form = element.find('form');
              scope.formCtrl = form.controller('form');
          }
      };
  }]);
  </code></pre>