伙计们,
我正在尝试让我的 ng-grid 在编辑时进行休息。
我从这篇文章中得到了线索: AngularJS and ng-grid - auto save data to the server after a cell was changed
但是,我不断收到此错误,如果有人遇到过类似的情况,请建议:
Error: No controller: ngModel
at Error (<anonymous>)
at getControllers (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4823:19)
at nodeLinkFn (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4960:35)
at compositeLinkFn (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4550:15)
at compositeLinkFn (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4553:13)
at publicLinkFn (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4455:30)
at Object.<anonymous> (http://www.yojit.com/app/lib/angular/ng-grid.js:2691:13)
at Object.applyFunction [as fn] (http://www.yojit.com/app/#/employeelist:778:50)
at Object.Scope.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:8811:27)
at Object.$delegate.__proto__.$digest (http://www.mysite.com/app/#/employeelist:844:31) <input type="text" ng-class="'colt' + col.index" ng-input="row.entity.firstname" ng-blur="updateEntity(col, row)">
我的 ng-grid 看起来像这样:在我的 html 文件中:
<div class="gridStyle" ng-grid="gridOptions"> </div>
在我的控制器中:
var nameEditableTemplate = "<input type=\"text\" ng-class=\"'colt' + col.index\" ng-input=\"COL_FIELD\" ng-blur=\"updateEntity(col, row)\"/>";
$scope.gridOptions = { data: 'employees',
columnDefs: [
{displayName:'Id', field:'id'},
{displayName:'First', field:'firstname',enableCellEdit:true, editableCellTemplate:nameEditableTemplate },
{displayName:'Middle', field:'middlename'} ,
{displayName:'Last', field:'lastname'}
],
enableCellSelection: true,
multiSelect:false,
}; //end of grid options