angular-ui/ui-grid

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

Open

#6.250 geöffnet am 5. Juni 2017

Auf GitHub ansehen
 (0 Kommentare) (2 Reaktionen) (1 zugewiesene Person)JavaScript (2.496 Forks)batch import
good first issue

Repository-Metriken

Stars
 (5.395 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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

Contributor Guide