angular-ui/ui-grid

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

Open

#6250 aperta il 5 giu 2017

Vedi su GitHub
 (0 commenti) (2 reazioni) (1 assegnatario)JavaScript (2496 fork)batch import
good first issue

Metriche repository

Star
 (5395 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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 {
...
      }

Guida contributor