title: AngularJS ng-if and scopes
body: <p>I am trying to understand ng-if and scopes. As I am aware, ng-if creates a new child scope. Here is my issue:</p>
  
  <p>View</p>
  
  <pre><code>&lt;input ng-model="someValue1" /&gt;
  &lt;div ng-if="!someCondition"&gt;
      &lt;input ng-model="$parent.someValue2" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>$scope.someCondition = true;
  
  if ($scope.someCondition) {
      $scope.someValue2 = $scope.someValue1;        
  }
  </code></pre>
  
  <p>If someCondition is set to true, then someValue2 should be the same as someValue1.</p>
  
  <p>My problem is that I can't access someValue2 in both situations (true or false). How could I achieve this?</p>