1
私はこのangularjsコードの助けを探しています。古いラベルが新しいラベルと一致しないときテーブルへの行追加
{{notification.label}}
が1つの値から別の値に変更されると(テーブルの内容はデータベースからのものです)、新しい行を追加したいと思います。しかし、私はそれが動作するようにすることはできませんが、主にこれをどうやって行うのかわからないからです。好ましくは、テーブルを閉じて新しいテーブルを作成することもできますが、ループがTRにあるため、これを推測できません。
いくつかの方向や例があります。既にIfディレクティブを試しましたが、古いラベルと新しいラベルを比較できませんでした。
<div id=postModule data-ng-app="postModule" data-ng-controller="PostController" data-ng-init="init()"
<form novalidate name="notificationForm">
<table class="table table-bordered table-hover table-striped">
<tr data-ng-repeat="notification in post.notification | orderBy : 'label'">
<td>
{{notification.label}}
</td>
<td>
{{notification.vendor}}
</td>
<td>
{{notification.product}}
</td>
<td>
{{notification.version}}
</td>
<td>
{{notification.cve}}
</td>
<td>
{{notification.cvsscore}}"
</td>
</tr>
</table>
</form>
</div>
データベース:
notification.label || notification.vendor || notification.product
expensive || Samsung || Galaxy
expensive || Apple || iPhone
budget || Huawai || X
budget || Huawai || Y
私はこの(表)のようなものを見たい
notification.label || notification.vendor || notification.product
expensive || Samsung || Galaxy
expensive || Apple || iPhone
notification.label || notification.vendor || notification.product
budget || Huawai || X
budget || Huawai || Y
さらに良いものは2つのテーブル
notification.label || notification.vendor || notification.product
expensive || Samsung || Galaxy
expensive || Apple || iPhone
notification.label || notification.vendor || notification.product
budget || Huawai || X
budget || Huawai || Y
? – Vivz
Ajaxコード – RvdM
の助けを借りて読み込まれたデータベースからのデータそのデータベースから変更されたかどうかはどのようにわかりますか?だから、基本的にいくつかの値がデフォルトでページにあり、誰かがデータベースの値をラベルのために変更し、新しい行を追加する必要がありますか? – Vivz