Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.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
AngularJS ng网格捕获编辑事件_Angularjs_Angular Ui_Ng Grid - Fatal编程技术网

AngularJS ng网格捕获编辑事件

AngularJS ng网格捕获编辑事件,angularjs,angular-ui,ng-grid,Angularjs,Angular Ui,Ng Grid,我使用控制器作为角度传感器的别名功能。 我想将编辑触发器附加到网格。但是,我不知道应该使用哪种语法: 以下是我的代码: function CodeLibrary($scope, dataservice, logger) { var vm = this; vm.gridOptions = { data: 'cl.library', showFilter : true, enableColu

我使用控制器作为角度传感器的别名功能。 我想将编辑触发器附加到网格。但是,我不知道应该使用哪种语法:

以下是我的代码:

function CodeLibrary($scope, dataservice, logger) {
        var vm = this;



        vm.gridOptions = {
            data: 'cl.library',
            showFilter : true,
            enableColumnResize : true,
            enableRowSelection: true,


            width: 'auto',
            plugins: [new ngGridFlexibleHeightPlugin()],
            columnDefs: [{field:'id', displayName:'ID', width: '50'},
                {field:'key',  enableCellEdit: true, displayName:'KEY'},
                {field:'label',enableCellEdit: true,displayName:'Label'},
                {field:'value', enableCellEdit: true, displayName:'Value'}]
        };

        vm.$on('ngGridEventEndCellEdit', function(event) {
            //console.log(event.targetScope.gridId);
        });

}
我得到的错误是:

[NG模块错误]未定义不是一个函数

你知道我怎么修吗


我已经尝试过vm.$scope.$on以及$scope.$on

您必须在上使用$scope.$。您写道您已经尝试过,但它应该可以工作。@tasseKATT谢谢您,我会再试一次,但是$on返回空值。我需要注入任何指令吗?@tasseKATT No luck mate它仍然是相同的,即$scope.$on为空!我不知道我是否遗漏了任何注入语句。你能尝试在这里复制它吗?