angularjs - Get editable row of data from angular and sending it to WEB api -
how send 'save' event complete object including ever user has typed in row? now, 2 fields null no matter do.
(the temp comment) put this? want item data when 'save' clicked if put in there how refer specific row?
the example started used separate pages list/edit problem having how combine functionality 1 page.
var listctrl = function($scope, $location, msa) { $scope.items = msa.query(); //temp: since not know how value specific row var id = 1; $scope.msa = msa.get({id: id}); $scope.save = function() { msa.update({id: id}, $scope.msa, function() { $location.path('/'); }); } };
<tbody> <tr ng-repeat="msa in items"> <td>{{msa.placeid}}</td> <td>{{msa.name}}</td> <td> <div class="controls"> <input type="text" ng-model="msa.previousplaceid" id="previousplaceid"> </div> </td> <td> <div class="controls"> <input type="text" ng-model="msa.nextplaceid" id="nextplaceid"> </div> </td> <td> <div class="form-actions"> <button ng-click="save()" class="btn btn-primary"> update </button><i class="icon-save"></i> </div> </td> </tr> </tbody>
it looks it's in ng-repeat scope isn't same in controller in ng-repeat.
i think can send in current msa element items , in save method, loop through original list matching element that's sent in , update fields.
<button ng-click="save(msa)" class="btn btn-primary">
Comments
Post a Comment