title: Angular ng-if how do i reset the value of the model, in an angular way
body: <pre><code>&lt;div ng-app&gt;
  &lt;form ng-controller='chip'&gt;
      &lt;select data-ng-options="n for n in simOptions" data-ng-model="simQuantity"&gt;&lt;/select&gt;
      &lt;div ng-if="simQuantity&gt;=1"&gt;     
          &lt;select name="sim" ng-model="formData.sim[0]" ng-options="sim for sim in sims" &gt;&lt;/select&gt;
      &lt;/div&gt;
      &lt;div class="suscriptor_fields" ng-if="simQuantity&gt;=2"&gt;     
          &lt;select name="sim" 
          ng-model="formData.sim[1]" 
          ng-options="sim for sim in sims" &gt;&lt;/select&gt;
      &lt;/div&gt;
      &lt;div class="suscriptor_fields" ng-if="simQuantity&gt;=3"&gt;     
          &lt;select name="sim" 
          ng-model="formData.sim[2]" 
          ng-options="sim for sim in sims" &gt;&lt;/select&gt;
      &lt;/div&gt;
      &lt;div class="suscriptor_fields" ng-if="simQuantity&gt;=4"&gt;     
      &lt;select name="sim" 
          ng-model="formData.sim[3]" 
          ng-options="sim for sim in sims" &gt;&lt;/select&gt;
      &lt;/div&gt;
      {{formData.sim}}
  </code></pre>
  
  <p></p>
  
  <p>If in the first select i choose 2 to 4 and select a value in the second to fourth select options and then i reselect the first one with a lower value, the ng-if turns to false but the ng-model doesnt change i need to get it to null again, so if doesnt get sent when i submit the form. In a nutshell, if a user selects 2, will get two options, if he/she selects two options but then changes his/her mind and decides only wants 1, the field disappears but the value is still getting send when submit.
  this is the fiddle
  jsfiddle.net/U3pVM/13524/</p>
  
  <p>and the javascript part</p>
  
  <pre><code>function chip($scope) {
  $scope.formData = {
      'sim' : {
          '0' : null,
          '1' : null,
          '2' : null, 
          '3' : null
      }
  };
  $scope.simQuantity = 1;
      $scope.simOptions = [1,2,3,4];
      $scope.sims = [
          'Mini-SIM',
          'Micro-SIM',
          'Nano-SIM',
      ];
  </code></pre>
  
  <p>}</p>