Am面临一个带有角度* NgIf的语义UI下拉菜单的问题。将语义下拉列表放到任何NgIf条件中时。语义不起作用。当我删除该Ngif它的工作正常。任何解决方案。
* NgIf,现在,语义下拉列表将不起作用。它将显示正常下拉菜单。
<div *ngIf= "IsVisible">
<select class="ui selection dropdown"
<option value="" selected="selected">Bedroom</option>
<option *ngFor="let bedroom of bedrooms">
{{bedroom.bhk_numbers}}
</option>
</select>
</div>
如果我删除* NgIf。它将可以完美地实现语义UI。这样,
<div>
<select class="ui selection dropdown"
<option value="" selected="selected">Bedroom</option>
<option *ngFor="let bedroom of bedrooms">
{{bedroom.bhk_numbers}}
</option>
</select>
</div>
尝试使用[隐藏]而不是* ngIf。可能发生的情况是,因为元素不在DOM中,所以没有被初始化。使用[hidden],它将保留在DOM中但不可见。
<div [hidden]="!IsVisible">
<select class="ui selection dropdown"
<option value="" selected="selected">Bedroom</option>
<option *ngFor="let bedroom of bedrooms">
{{bedroom.bhk_numbers}}
</option>
</select>
</div>