在添加新行之前验证上一行

时间:2019-09-13 06:23:32

标签: angular8

我有一张表,它将迭代一些数据。用户还可以使用“添加”按钮将新数据添加为一行。我需要验证以前的
使用
添加新行之前添加行是否有任何字段为空 按钮点击

<form>
<table class="table table-striped table-hover">
<thead>
  <tr>
    <th class="min-padding-bottom">Col1</th>
    <th class="min-padding-bottom">Col2</th>
    <th class="min-padding-bottom">Col3</th>
    <th></th>
  </tr>
</thead>
<tbody>
  <tr *ngFor="let info of information;let i = index">
    <td *ngIf="!info.IsEditable">{{info.Col1}}</td>
    <td *ngIf="!info.IsEditable">{{info.Col2}}</td>
    <td *ngIf="!info.IsEditable">{{info.Col3}}</td>
    <td *ngIf="!info.IsEditable"></td>

    <td *ngIf="info.IsEditable"><input class="form-control" /></td>
    <td *ngIf="info.IsEditable"><input class="form-control" /></td>
    <td *ngIf="info.IsEditable"><input class="form-control" /></td>
    <td *ngIf="info.IsEditable"><span class="glyphicon glyphicon-minus-sign plus-sign-position add" (click)="deleteCurrentInfo(i)"></span></td>
  </tr>
</tbody>
</table>

</form>
<div class="col-lg-12 add" (click)="addNewInfo()"><span class="glyphicon glyphicon-plus-sign plus-sign-position"></span>Add additional row</div>

在添加新行之前,每列都应该有验证消息

0 个答案:

没有答案