[英]Angular2 forms - access value in ngIf
我有一個<select #type >
。 現在,我稍后需要在ngIf模板中引用此select的值,但是我該怎么做呢?
嘗試過*ngIf='type.value!="Category"'
,它似乎並沒有解決問題。
您能否將選擇綁定到模型,然后引用模型元素?
<select [(ngModel)]="type">
<!-- Options -->
</select>
<div *ngIf="type !== 'Category'">
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.