angular-ui/ui-grid

Using $viewContentLoaded with ui-grid throws "Cannot read property 'data' of undefined"

Open

#6.250 aberto em 5 de jun. de 2017

Ver no GitHub
 (0 comments) (2 reactions) (1 assignee)JavaScript (2.496 forks)batch import
good first issue

Métricas do repositório

Stars
 (5.395 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Using ui-grid with $viewContentLoaded throws the following error, because data and the grid are not initialized until the view is loaded. Ui-grid works fine but spits out this error,

angular.js:14525 TypeError: Cannot read property 'data' of undefined
    at new <anonymous> (ui-grid.js:3332)
    at Object.invoke (angular.js:5003)
    at $controllerInit (angular.js:10866)
    at nodeLinkFn (angular.js:9746)
    at angular.js:10154
    at processQueue (angular.js:16832)
    at angular.js:16876
    at Scope.$digest (angular.js:17971)
    at Scope.$apply (angular.js:18269)
    at bootstrapApply (angular.js:1917)

Line in question:

      } else {
        if (angular.isString($scope.uiGrid.data)) {
          deregFunctions.push( $scope.$parent.$watchCollection($scope.uiGrid.data, dataWatchFunction) );
        } else {
...
      }

Guia do colaborador