title: Cannot read property 'selection' of undefined
body: <p>I'm using ui-grid. But I cannot get the $scope.gridApi from download function. And get the error: Cannot read property 'selection' of undefined. Somebody can tell me the reason? thanks.</p>
  
  <pre><code>    $scope.gridOptions.onRegisterApi = function (gridApi) {
          $log.info('gridApi...');
          $scope.gridApi = gridApi;
          $log.info($scope.gridApi);
      };
      $scope.download = function ($event) {
          $event.stopPropagation();
          var selectedRows = $scope.gridApi.selection.getSelectedRows();
          $log.log('selectedRows....');
          $log.log(selectedRows);
      };
  </code></pre>