基于 If 条件,我想按照 angular2 中的要求制作字段
Based on If condition I want make the field as required in angular2
<div *ngFor="let proc of procInputList" >
<label >{{proc.key_ | Capitalize}}</label>
<input id="{{proc.key_}}" name="inputparams" type ="text" class="form-control" required = "proc.r_q == Y ? required :none" />
</div>
但不幸的是它对我不起作用..而且我不想在那里使用表格。
要调节属性,您可以:
<input class="form-control" [required] = "proc.r_q == 'Y'" />
<div *ngFor="let proc of procInputList" >
<label >{{proc.key_ | Capitalize}}</label>
<input id="{{proc.key_}}" name="inputparams" type ="text" class="form-control" required = "proc.r_q == Y ? required :none" />
</div>
但不幸的是它对我不起作用..而且我不想在那里使用表格。
要调节属性,您可以:
<input class="form-control" [required] = "proc.r_q == 'Y'" />