title: Angular javascript array is empty?
body: <p>Angular  javascript array  is empty?
  I have an array of checkboxes    databound to an angular scoped list 
  I need to check a few checkboxes and send bind them to a second angular scoped array:</p>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;tr ng-repeat="item in pagedItems[currentPage]" 
      ng-controller="DealerComMaintainCtrl"&gt;
    &lt;td align="center"&gt;
  
      &lt;input type="checkbox" id="{{item.IdArticle}}" 
             ng-value="item.IdArticle" 
             ng-checked="selected.indexOf(item.IdArticle) &gt; -1" 
             ng-click="toggleSelect(item.IdArticle)" /&gt;
  
    &lt;/td&gt;
    &lt;td&gt;
      &lt;a href="/Dealercoms/ArticleDownload?FileName={{item.FileName}}&amp;IdArticle={{item.IdArticle}}" 
         class="btn btn-xs btn-total-red btn-label"&gt;&lt;i class="ti ti-download"&gt;&lt;/i&gt;&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;{{item.DateArticle | date:'dd/MM/yyyy'}}&lt;/td&gt;
    &lt;td&gt;{{item.Title}}&lt;/td&gt;
    &lt;td&gt;{{item.Archive}}&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>And JS in the controller:</p>
  
  <pre><code>$scope.selected = [];
  
  $scope.toggleSelect = function toggleSelect(code) {
    var index = $scope.selected.indexOf(code)
  
    if (index == -1) {
      $scope.selected.push(code)
    } else {
      $scope.selected.splice(index, 1)
    }
  }
  
  $scope.ArchiveDocs = function() {
    var selectedoptionz = $scope.selection;
    console.log(selectedoptionz);
  };
  </code></pre>