Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 信号机&x2B;AG Grid AngularJS gridoption api未定义_Javascript_Angularjs_Angularjs Scope_Signalr_Ag Grid - Fatal编程技术网

Javascript 信号机&x2B;AG Grid AngularJS gridoption api未定义

Javascript 信号机&x2B;AG Grid AngularJS gridoption api未定义,javascript,angularjs,angularjs-scope,signalr,ag-grid,Javascript,Angularjs,Angularjs Scope,Signalr,Ag Grid,我正在使用信号器与AngularJS Ag网格。每当有广播发送到客户端时,我都会更新网格中的行 hub.client.Update = function (response) { if (response) { var positionsResponse = angular.fromJson(response); $rootScope.$apply(function () {

我正在使用信号器与AngularJS Ag网格。每当有广播发送到客户端时,我都会更新网格中的行

 hub.client.Update = function (response) {
           if (response) {
               var positionsResponse = angular.fromJson(response);
               $rootScope.$apply(function () {
                   $scope.response = angular.fromJson(positionsResponse.GridData);
                    $scope.gridOptions.api.setRowData($scope.response);
               });

           }
       };
在setRowData行中,我得到一个错误,即api未定义。gridOptions已正确填充

提前感谢。


页面加载时控制台中是否出现错误,即使网格填充正确?在尝试从$http post刷新网格时,我遇到了相同的问题。最后,这是由于我在多个嵌套div中指定了ng控制器:

<body ng-app="app" ng-controller="ctrl">
         <div ag-grid="gridOptions" class="ag-fresh" style="height:100%;" ng-controller="ctrl"></div>
</body>

通过仅在其自身解析后指定它:

<body ng-app="app" ng-controller="ctrl">
       <div ag-grid="gridOptions" class="ag-fresh" style="height:100%;"></div>
</body>

我不知道这是否有帮助,但我想和大家分享一下


/我真希望这个问题能有答案。