title: Get Property Value From Parent Directive within Child Directive
body: <p>I have two Angular directives, one nested inside the other as shown below.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;gss-response-group response-group-id="43" response-group-title="'Group Title'"&gt;
    &lt;gss-response-option option-id="5" option-text="'Very Often'" option-value="5.00" options-inline="true" type="'radio'"&gt;&lt;/gss-response-option&gt;
    &lt;gss-response-option option-id="6" option-text="'Often'" option-value="4.00" options-inline="true" type="'radio'"&gt;&lt;/gss-response-option&gt;
    &lt;gss-response-option option-id="7" option-text="'Sometimes'" option-value="3.00" options-inline="true" type="'radio'"&gt;&lt;/gss-response-option&gt;
    &lt;gss-response-option option-id="8" option-text="'Rarely'" option-value="2.00" options-inline="true" type="'radio'"&gt;&lt;/gss-response-option&gt;
    &lt;gss-response-option option-id="9" option-text="'Never'" option-value="1.00" options-inline="true" type="'radio'"&gt;&lt;/gss-response-option&gt;
  &lt;/gss-response-group&gt;
  </code></pre>
  
  <p><strong>responseGroup.template.html</strong></p>
  
  <pre><code>  &lt;div class="gss-response-group"&gt;
      &lt;label class="gss-response-group-title" ng-if="responseGroupTitle != null"&gt;{{responseGroupTitle}}&lt;/label&gt;
      &lt;placeholder&gt;&lt;/placeholder&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p><strong>responseOption.template.html</strong></p>
  
  <pre><code>&lt;div ng-class="{'gss-response-option': optionsInline}"&gt;
    &lt;input class="gss-{{type}}-option" id="{{id}}" name="{{groupName}}" type="{{type}}" value="{{optionValue}}" /&gt;
    &lt;label class="gss-option-text" for="{{id}}"&gt;{{optionText}}&lt;/label&gt;
    &lt;div class="gss-specifyanswer" ng-if="specify"&gt;
      &lt;label class="gss-specifyanswer" ng-if="specifyText != null"&gt;{{specifyText}}&lt;/label&gt;
      &lt;textarea class="gss-specifyanswer" maxlength="5000" disabled&gt;&lt;/textarea&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>'use strict';
  
  angular.module( 'gssApp', [ 'gss.directives' ] );
  
  angular.module( 'gssApp' )
  
  .controller( 'gssAppController', [
  
      '$scope',
      '$http',
      '$rootScope',
  
      function ( $scope, $http, $rootScope )
      {
  
      }] );
  
  var directiveModule = angular.module( 'gss.directives', [] );
  
  directiveModule.directive( 'gssResponseGroup', function ()
  {
    return {
      restrict: 'E',
      transclude: true,
      replace: true,
      scope: {
        responseGroupTitle: '=',
        responseGroupId: '='
      },
      templateUrl: 'responseGroup.template.html',
      link: function ( scope, element, attrs, ctrl, transclude )
      {
        element.find( 'placeholder' ).replaceWith( transclude() );
      },
      controller: [
  
          '$scope',
          '$rootScope',
          '$element',
          '$attrs',
  
      function ( $scope, $rootScope, $element, $attrs )
      {
  
      }]
    };
  } );
  
  directiveModule.directive( 'gssResponseOption', function ()
  {
    return {
      restrict: 'E',    
      transclude: true,
      replace: true,
      scope: {
        responseGroupId: '=',
        optionId: '=',
        optionText: '=',
        optionValue: '=',
        type: '=',
        optionsInline: '=',
        specify: '=',
        specifyText: '='      
      },
      templateUrl: 'responseOption.template.html',
      controller: [
  
          '$scope',
          '$rootScope',
          '$element',
          '$attrs',
  
      function ( $scope, $rootScope, $element, $attrs )
      {
        // HOW DO I GET THE PARENT DIRECTIVE'S SCOPE TO USE THE
        // responseGroupId FROM IT?
        $scope.id = 'rgID' + '_' + $scope.responseGroupId + '_' + $scope.optionId;
        $scope.groupName = 'rg' + '_' + $scope.responseGroupId;
      }]
    };
  } );
  </code></pre>
  
  <p>I want the child directive to have access to the "response-group-id" field in the parent.  How do I do this?  I was able to get the value by having the parent directive be required by the child directive and then getting it within the "link" method of the child directive but by then it was too late to be applied to the child template.</p>
  
  <p><a href="http://plnkr.co/edit/eACnxU9V1CjziQ3m6ccX?p=preview" rel="nofollow">Code in Plunker</a>.</p>
  
  <p>Also, if anyone could tell me why the CSS isn't being applied within my Plunker project, I'd appreciate it (though not a big deal).</p>