title: Have an AngularJS Ui-grid Error
body: <p>I have a single page application with angular js, mongoose, express and so on. Tried to use angular ui grid and have an error: </p>
  
  <blockquote>
    <p>"TypeError: Cannot read property 'data' of undefined
        at new  (ui-grid.js:2967)
        at Object.e [as invoke] (angular.js:4203)
        at $get.w.instance (angular.js:8493)
        at angular.js:7739
        at r (angular.js:331)
        at B (angular.js:7738)
        at $get.c (angular.js:8016)
        at g (angular.js:7117)
        at B (angular.js:7763)
        at g (angular.js:7117)"</p>
  </blockquote>
  
  <p>this is part of my controller:</p>
  
  <pre><code>angular.module('flatCtrl', ['flatService', 'ui.grid'])
      .controller('FlatController', function(Flat, socketio){
  
          vm = this;
  
          Flat.allFlat()
              .success(function(data){
                  vm.flats = data;
                  console.log(vm.flats);
                  vm.gridOptions.data = data;
  
              })
  </code></pre>
  
  <p>and part of HTML:</p>
  
  <pre><code>&lt;div class="col-md-12" ng-controller="FlatController as flat"&gt;
          &lt;div ui-grid="gridOptions"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>if i try to use <code>vm.gridOptions.data = data</code> after success nothing changes.</p>
  
  <p>in <code>console.log(vm.flats)</code> have all my objects:</p>
  
  <blockquote>
    <p>[Object, Object, Object, Object, Object, Object, Object, Object,
    Object, Object, Object, Object]0: Object1: Object2: Object3: Object4:
    Object5: Object6: Object7: Object8: Object9: Object10: Object11:
    Object</p>
  </blockquote>
  
  <p>so, in data i have data</p>