4
我有两个字符串数组,我想通过其中的一个迭代取决于条件。我如何避免代码重复?现在*ngIf
现在:条件* ngFor
<tr *ngIf="!condition">
<td *ngFor="let field of firstArray">{{field}}</td>
</tr>
<tr *ngIf="condition">
<td *ngFor="let field of secondArray">{{field}}</td>
</tr>
有没有更好的方法?
呵呵,我想过这样。我必须尝试!无论如何,谢谢。这正是我需要的。 –