验证必填字段的下拉列表,而在角度2、4、5、6中没有任何表单标签。您能提供解决方法吗?
我尝试使用ng-model
<span style="color:red" *ngIf="!selectedCountry">
Mandatory Field
</span>
<div class="some class">
<div class=some class" [class.active]="dropdown.open"
(clickOutside)="dropdown.open = false">
<div class="some class" (click)="toggleDropdown(dropdown.open)">
<label>Select Country
Name</label>
<input class="font-sz-14" type="text" id="select-country"
[(ngModel)]="selectedCountry" placeholder="" required >
</div>
<div class="dropdown__menu">
<div class="country-list">
<a *ngFor="let country of countries;let i = index;"
(click)="selectCountry(country.countryId,country.countryName,countryDropdown)">{{country.countryName}}</a>
</div>
</div>
</div>
</div>
应用快速响应