我有一個模型,它是一個數組元素。我想清除ngIf condition.Please每個元素的值在下面找到HTML:在angular2中重置ngIf的ngModel值
<div *ngIf="flag" >
<table id="table" class="table table-hover table-bordered table-mc-light-blue">
<thead>
<tr>
<th>col 1</th>
<th>col 2</th>
</tr>
</thead>
<tr *ngFor="let item of collection;">
<td>{{item.col1}}</td>
<td>
<input type="text" class="form-control" [(ngModel)]="item.col2" #input="ngModel" name="input-{{i}}">
</td>
</tr>
</table>
</div>
在標誌設置爲false,我想清楚了收集的所有值。 有一個選項初始化集合,但我不想這樣做,因爲我有幾個這樣的集合。
任何幫助將是可觀的!
什麼時候'flag'的值會改變什麼事? – Aravind
實際上,沒有事件,我將該標誌變量綁定到單選按鈕上作爲ngmodel。關於單選按鈕的更改,我正在顯示內容 –
謝謝。 。 。 ..。 – Aravind