ユーザーがその行に入力した内容を含む完全なオブジェクトを「保存」イベントに送信するにはどうすればよいですか? 今のところ、これらの 2 つのフィールドは、何をしても常に NULL です。
(一時コメント) これはどこに入れますか? 「保存」がクリックされたときに項目データを取得したいのですが、そこに入れた場合、特定の行を参照するにはどうすればよいですか?
私が始めた例では、リスト/編集用に別々のページを使用していたので、私が抱えている問題は、機能を 1 つのページに結合する方法です。
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>{{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>