<div class="form-group">
<div class="row mb-1">
<div class="col">
Select Functions from the list below:<br />
<div class="div-table mdle_rec">
<div *ngIf="allFunctions.length > 0" class="div-table-row">
<div *ngFor="let fnc of allFunctions;let i = index" class="div-table-col">
<input class="checkbox align-middle mr-1" type="checkbox" id="{{'fnc'+fnc.FunctionId}}" [checked]="fnc.IsSelected" (change)="onFuncSelectionChange(fnc.FunctionId, $event)" required>
<span style="font-size:16px">{{fnc.Description}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
至少应选中一个复选框。如果未选中至少一个复选框,则应该引发错误。
答案 0 :(得分:0)
您可以使用吸气功能:
get someChecked()
{
return allFunctions?allFunctions.some(x=>x.IsSelected):false
}
使用
<div *ngIf="!someChecked()">You sould check at least one</div>