Get editable row of data from angular and sending it to WEB api
How do I send to the 'save' event the complete object including what ever
th euser has typed in that row ? For now those 2 fields are always NULL no
matter what I do.
(the temp comment) Where do I put this ? I want to get the item data when
the 'save' is clicked but I if I put it in there how do I refer to the
specific row ?
The example I started with used separate pages for list/edit so the
problem I am having is how to combine the functionality into one page.
var ListCtrl = function ($scope, $location, Msa) {
$scope.items = Msa.query();
//temp: since I do not know how to get the value for 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></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>
No comments:
Post a Comment