我的表如下插入在NG重複表中的獨立變量範圍值
<tr ng-repeat-start="x in referral">
<td>{{x.id}}</td>
<td>{{x.name}}</td>
<td>{{x.region}}</td>
<td><button data-ng-click="request(x.id)">Request Info</button></td>
<td><span>{{x.upload_msg}}</span></td>
</tr>
和代碼如下:
referral.list($scope.user_id).then(function(response){
$scope.referral=response.data.data;
for (i=0;i< ($scope.referral).length; i++){
$scope.referral[i].upload_msg="";
}
});
最後一列初始化爲空。 現在,當有人點擊該按鈕時,它會檢查在一定條件是否滿足或不使用下面的函數在JS
$scope.request=function(id){
data={"user_id":id};
referral.request(data).then(function(response){
console.log(response);
$scope.upload_msg=response.data;
});
}
功能是除了一個事實,好顯示一條消息,當我檢查狀態表中的一行,它顯示了所有行中的上傳消息的值。我瞭解它,因爲我在表中插入一個範圍變量。
恐怕我不知道如何單獨顯示每個行upload_msg值。
幫助將十分讚賞。
一個想法是添加一個「上傳」屬性以便您可以在最後的td – CyrillC
中添加'ng-if =「x.uploaded」',或者如果每個用戶的上傳消息不同,則將其直接添加到用戶中並使用x.upload_message顯示它。 – CyrillC
我面臨的問題是如何更新「已上傳」屬性只是針對該特定行而不是影響所有行 –