angular-ui/ui-grid

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

Open

#6,250 创建于 2017年6月5日

在 GitHub 查看
 (0 评论) (2 反应) (1 负责人)JavaScript (5,395 star) (2,496 fork)batch import
good first issue

描述

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

贡献者指南