私は1つのテーブルを持っています。行を非表示にし、編集と保存のために角度を使って表示しています。 正常です。私はテーブルの行の[編集]ボタンをクリックしたとき現在の行のng-hideとng-show
$scope.init=function(){
$scope.editable=true;
}
さて、編集ボタンを隠してして保存されるボタンが表示されます。ここで
$scope.editRow = function(id){
console.log(id);\\row id will be displayed here
$scope.editable=false;
}
私は2行目の[編集]をクリックした場合、唯一の二行は編集可能である必要があり、1つの問題に直面しています。
私はこれを簡単にjquery.Butの行IDを使用して行うことができることを知っていますここで私はng-hide
とng-show
の角でこれを行う方法がわかりません。
ヘルプがありますか?ありがとうございます
コード:
<table>
<thead>
<tr>
<th>Qualification</th>
<th>Course</th>
<th>Grade Attained</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="detail in educationDetails">
<td>
<span ng-show="editable">{{detail.qualification}}</span>
<input type="text" ng-model="detail.qualification" ng-hide="editable"/>
</td>
<td>
<span ng-show="editable">{{detail.education_type}}</span>
<input type="text" ng-model="detail.education_type" ng-hide="editable"/>
</td>
<td>
<span ng-show="editable">{{detail.grade}}</span>
<input type="text" ng-model="detail.grade" ng-hide="editable"/>
</td>
<td>
<div ng-show="editable">
<span><i class='fa fa-trash-o' ng-click="deleteEducationDetail(detail)"></i></span>
<span><i class='fa fa-pencil' ng-click="editEducationDetail(detail)"></i></span>
</div>
<div ng-hide="editable">
<span><i class='fa fa-floppy-o' ng-click="updateEducationDetail(detail)"></i></span>
<span><i class='fa fa-times' ng-click="cancelEducationDetail(detail)"></i></span>
</div>
</td>
</tr>
</tbody>
</table>
$scope.init = function() {
$scope.editable = true;
}
$scope.editEducationDetail = function (detail) {
detail.editable = false;
}
各行に配列が必要です – Sajeetharan
はい、配列を持っています。 – krish
オブジェクトを渡して、特定のオブジェクトの編集可能な状態にする – Sajeetharan