REST alarms for Angularjs ng-grid

People,

I am trying to get my ng grids to make other calls when editing.

I followed this post: AngularJS and ng-grid - automatically save data on server after cell change

However, I keep getting this error if someone encounters something similar, advises:

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)"> 

my ng-grid looks like this: in my html file:

 <div class="gridStyle" ng-grid="gridOptions"> </div> 

in my controller:

  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 
+4
source share
1 answer

Your ng model is missing from the template

 var nameEditableTemplate = "<input type=\"text\" ng-class=\"'colt' + col.index\" ng-model=\"COL_FIELD\" ng-input=\"COL_FIELD\" ng-blur=\"updateEntity(col, row)\"/>"; 

Hope this solves it

0
source

Source: https://habr.com/ru/post/1491983/


All Articles