title: Proper method to handle Angular scope instead of $parent.$parent
body: <p>I've been reading a few articles, and haven't found the example that solves my issue.</p>
  
  <p>My understanding is that:</p>
  
  <ol>
  <li><code>ng-if</code> and <code>ng-repeat</code> create isolate scopes.</li>
  <li>Using <code>$parent.someProperty</code> is bad.</li>
  <li>Using <code>$parent.$parent.someProperty</code> would be an abomination.</li>
  </ol>
  
  <p>So, with the given template markup, how can I properly bind the the controller <em>so that the controller property updates</em>?</p>
  
  <p><strong>Markup:</strong><br>
  (note the nested <code>ng-if</code> and <code>ng-repeat</code>, creating a sort of <code>$parent.$parent</code> situation)  </p>
  
  <pre><code>&lt;div ng-app="MyApp" ng-controller="MyCtrl"&gt;
    &lt;div ng-if="showOnCondition"&gt;
      &lt;label ng-repeat="item in repeatingItems"&gt;
        {{item}}
        &lt;setting item="item" /&gt;
      &lt;/label&gt;
    &lt;/div&gt;
    {{checkSetting()}}
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong>  </p>
  
  <pre><code>var myApp = angular.module('MyApp', []);
  
  myApp.controller('MyCtrl', function($scope) {
    $scope.settings = {
      someProperty: '',
      anotherProperty: 'Hello'
    }
  
    $scope.repeatingItems = [
      'One',
      'Two',
      'Three'
    ];
  
    $scope.showOnCondition = true;
  
    $scope.checkSetting = function() {
      // When calling checkSettings(), I would like to access the value of someProperty here
      return $scope.settings;
    }
  });
  
  myApp.directive('setting', function() {
    return {
      restrict: 'E',
      require: '^myCtrl',
      // HOW DO I SOLVE THIS?
      // $parent.$parent is bad.
      template: '&lt;input type="radio" ng-model="$parent.$parent.settings.someProperty" name="mySetting" value="{{item}}" /&gt;',
      scope: {
        settings: '=',
        item: '='
      }
    };
  });
  </code></pre>
  
  <p>Given the above example, how to I properly construct the directive and / or markup in order to access <code>settings.someProperty</code> in the controller? Or is there something entirely different I need to be doing?</p>
  
  <p><strong>Clarification</strong><br>
  There seems to be some confusion around what I'm trying to do.  The <code>someProperty</code> is available in the directive - that is working fine.  Please note I'm trying to <em>assign values</em> to the controller's <code>someProperty</code> property from <em>within</em> the directive (using ng-model)</p>
  
  <p><strong>Update</strong><br>
  I've revised the code above to known, working code, plus added a <a href="http://jsfiddle.net/XyUGE/473/" rel="nofollow">jsFiddle</a>.
  Note that it <em>works</em>, but it uses <code>$parent.$parent</code> in the template.  This is the problem I need to understand how to solve.</p>