リストから選択したアイテムを別のhtmlビューで編集しようとしているので、save button
をクリックすると、変更がmain view
のリストに反映されます。編集私はtitle
、description
、from
およびto
の編集日付を使用しています。私はここでアイデアを打ち明かしました。つまり、ユーザーが4つの詳細のいずれかを編集して残りの詳細を同じに保存したい場合はどうしましたかそれはng-model
であるが、編集された詳細のみを読み取ることができるが、既存のものは読み取ることができない。だから私はこれについて助けを求めている。anglejsのユーザの選択に応じて編集して更新する方法
HTML:
<div align="center">
Title
<input type="text" ng-model="selectInput.Title">
Offer:
<input type="text" ng-model="selectInput.data.description">
Valid from:
<input type="date" ng-click="FromDate()" ng-model="frDate">
<br> Valid till:
<input type="date" ng-click="ToDate()" ng-model="toDate" />
</div>
<hr>
<button ng-click='SaveEdit($index)' ng-model="editSave"> Save</button>
コントローラ:
$scope.items = [];
$rootScope.couponList = [{ Title: "Fruit Export Details" data: {description: "consume soon product", Fromdate: "2016-09-09", Todate: "2016-09-18"}},
{Title: "Vegetables Export Details", data:{description: "consume soon product", Fromldate: "2016-11-09", Todate: "2016-10-19"}},
{ CouponTitle: "Saviours",data:{description: "storable", Fromldate: "2016-09-10", Todate: "2016-10-09"}}];
$scope.select_item = function (key) {
//alert(key);
$scope.items.push(key);
}
$scope.SaveEdit=function(){
$scope.Title=$scope.selectInput.data.Title;
$scope.description=$scope.selectedInput.data.description;
$scope.Fromdate=$scope.selectInput.data.Fromdate;
$scope.Todate=$scope.selectInput.data.Todate;
}
$state.go('app.WashType');
}