title: Getting select rows from ng-grid?
body: <p>How do I create (or access) an array of selected rows in my <a href="https://github.com/angular-ui/ng-grid" rel="noreferrer">ng-grid</a>?</p>
  <hr />
  <h3><a href="http://angular-ui.github.io/ng-grid/#api" rel="noreferrer">Documentation</a> (scroll to &quot;Grid options&quot;)</h3>
  <pre><code>id                 | default value | definition
  -----------------------------------------------
  selectedItems      |       []      | all of the items selected in the grid.
                                       In single select mode there will only
                                       be one item in the array.
  </code></pre>
  <h3>index.html</h3>
  <pre class="lang-html prettyprint-override"><code>&lt;body ng-controller=&quot;MyCtrl&quot;&gt;
      &lt;div class=&quot;gridStyle&quot; ng-grid=&quot;gridOptions&quot;&gt;&lt;/div&gt;
  
      &lt;h3&gt;Rows selected&lt;/h3&gt;
      &lt;pre&gt;{{selectedItems}}&lt;/pre&gt;
  &lt;/body&gt;
  </code></pre>
  <h3>main.js</h3>
  <pre class="lang-js prettyprint-override"><code>var app = angular.module('myApp', ['ngGrid']);
  app.controller('MyCtrl', function($scope) {
      $scope.myData = [{name: &quot;Moroni&quot;, age: 50},
                       {name: &quot;Tiancum&quot;, age: 43},
                       {name: &quot;Jacob&quot;, age: 27},
                       {name: &quot;Nephi&quot;, age: 29},
                       {name: &quot;Enos&quot;, age: 34}];
      $scope.gridOptions = { data: 'myData' };
  });
  </code></pre>
  <p><a href="http://plnkr.co/edit/loRe5d?p=preview" rel="noreferrer">Plnkr for the code</a> (and to run it)</p>