title: Cannot set parent variable using child scope created via ng-if
body: <p>I have the following div</p>
  
  <pre><code>&lt;div class="form-group col-lg-12 ignore-left-padding" ng-show="!labeledIntents"&gt;
    &lt;label for="intent-count"&gt;&lt;h4&gt;Number of intents&lt;/h4&gt;&lt;/label&gt;
       &lt;div&gt;
          &lt;switcher ng-model="manualNumberOfIntents"
                    ng-change="onSwitcherChange()" 
                    false-label="Autodetect" true-label="Manual input"&gt;
          &lt;/switcher&gt;&amp;nbsp;
          &lt;input ng-if="manualNumberOfIntents" show-focus="autoNumberOfIntents"
                 ng-model="$parent.count" type="number" step="1" min="1" 
                 max="200" id="intent-count" placeholder="1-200"
                 style="width: 75px;" required/&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In there i have a switch which, when turned on, displays a number box that is mandatory. For this text box I set it such that it appears when "manualNumberOfIntents" is enabled. After that the user is needed to enter a number in it or an error message pops up. once everything is set, the user presses a submit button which creates a project of some sort using the information provided. </p>
  
  <p>Here is part of the function which is called when submit is pressed:</p>
  
  <pre><code>$scope.submit = function (event) {
      event.preventDefault();
      if (!$scope.file) {
        return;
      }
      $scope.projectNameDuplication = false;
      $scope.requestInProgress = true;
      var projectname = $scope.projectname.trim();
      var userparticipant = $scope.customChatParticipants ? $scope.userparticipant : "USER";
      var agentparticipant = $scope.customChatParticipants ? $scope.agentparticipant : "AGENT";
      var count = $scope.manualNumberOfIntents ? $scope.count : false;
      console.log($scope.count);
  </code></pre>
  
  <p>It then uses the variables and processes them.</p>
  
  <p>Here is the function which gets called when the switch is activated:</p>
  
  <pre><code>$scope.onSwitcherChange = function () {
      $scope.count = '';
    }
  </code></pre>
  
  <p>In the code above console.log returns nothing no matter what i tried to set for count. Which brings me to believe that count is just set to '' via $scope.onSwitchChange but never touched again. I did some research and found that ng-if creates its own scope and so if i use ng-model="count" it would not work since it is trying to reference count in a scope that the parent cannot access. Thus I put ng-model="$parent.count". However this still does not seem to work... does anyone have any ideas?</p>
  
  <p>When i modify $scope.count, it does so under the parent scope so it should not affect the way i reference it in the html right? Any suggestions would be greatly appreciated! I am quite new at angularjs so i apologize in advance if this is an obvious question.</p>