angularjs - How to update a row in angular ng-grid -


i use ng-grid , have array store data.

$scope.list = [{...},{...},{...}]

now want update data in 1 object (namely in row):

i tried $scope.list[index] = {...} , changed value, nothing in html updated.

the ways below work me, not pretty think.

arr = angular.copy($scope.list) arr[index] = {...} $scope.list = arr

or

$scope.list[index].attr_1 = sth; $scope.list[index].attr_2 = sthelse; ...

updated:

  $scope.pickproduct = ()->     $scope.errormessage = ''     $http.post('/api/delivery_items/pick.json',        barcode: $scope.scannedbarcode     ).success((data, status, headers, config) ->       $scope.scannedbarcode = ''       angular.foreach $scope.picklist, (row, index) ->         if row.id == data.id           # update data doesn't change row in html           $scope.picklist[index] = data.delivery_item     ).error((data, status) ->       if data.status 'nok'         $scope.scannedbarcode = ''         $scope.errormessage = data.message     ) 


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -