title: Angular ui-grid | TypeError: Cannot read property 'core' of undefined
body: <p>I am having trouble trying to bind my data to the data gridOptions.  I read that doing a refresh would help load the data however when I add the logic it errors out.  </p>
  
  <p>Please help... </p>
  
  <p><strong>&lt;&lt;&lt;&lt;&lt;&lt;  HTML Code  >>>>>></strong></p>
  
  <pre><code>&lt;div ng-controller="MainCtrl"&gt;
      &lt;br /&gt;
      &lt;b&gt;{{msg}}&lt;/b&gt;
      &lt;div id="grid1" ui-grid="gridOptions" class="grid" ui-grid-pagination&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>&lt;&lt;&lt;&lt;&lt;&lt;  JavaScript Code  >>>>>>></strong></p>
  
  <pre><code>   var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.edit', 'ui.grid.pagination']);
  app.controller('MainCtrl', function($scope, $filter, $http, $timeout) {
      $scope.gridOptions = {
          enableSorting: true,
          enableRowSelection: true,
          enableRowHeaderSelection: false,
          enableFiltering: true,
          selectionRowHeaderWidth: 35,
          rowHeight: 35,
          multiSelect: true,
          enableGridMenu: true,
          columnDefs: [
                  { name: 'client' },
                  { name: 'qa_ver' },
                  { name: 'qa_build_no' },
                  { name: 'qa_build_date' },
                  { name: 'prod_ver' },
                  { name: 'prod_build_no' },
                  { name: 'prod_build_date' },
                  { name: 'prod_deploy_date' },
                  { name: 'deploy_src' }      
      ],
          data: 'jsonData',
          paginationPageSizes: [5, 10, 25, 50],
          paginationPageSize: 5,
      }
  
      $timeout(function() {
          getJSONData();
          $scope.data = jsonData;
          $scope.gridOptions.data = $scope.data;
      }, 3000);
  
  $scope.gridOptions = {
        onRegisterApi: function(gridApi){ $scope.gridApi = gridApi;}
      }
      $scope.gridApi.core.refresh();
  </code></pre>
  
  <p><strong>&lt;&lt;&lt;&lt;&lt;&lt;  Error Thrown >>>>>></strong></p>
  
  <p>TypeError: Cannot read property 'core' of undefined</p>
  
  <pre><code>at new &lt;anonymous&gt; (dashboard.html:114)
  at Object.invoke (angular.js:4625)
  at $controllerInit (angular.js:10027)
  at nodeLinkFn (angular.js:8965)
  at compositeLinkFn (angular.js:8333)
  at compositeLinkFn (angular.js:8336)
  at compositeLinkFn (angular.js:8336)
  at publicLinkFn (angular.js:8213)
  at angular.js:1715
  at Scope.$eval (angular.js:17025)
  </code></pre>