我正在尝试获取选择选项的文本,然后将其发送到firebase数据库,您知道如何吗?我也在努力实现。谢谢。
<form #alquilerForm="ngForm" (ngSubmit)="enviarDatos(alquilerForm)">
<div class="input-field col s12 m6">
<select [(ngModel)]="selected" id="selected" name="selected" class="icons">
<option value="" disabled selected>Seleecione un auto</option>
<option value="1">2016 Honda CR-V EX</option>
<option value="2">Hyundai Accent</option>
<option value="3">Hilux 4WD Double Cab SR5 Cruiser Ute</option>
</select>
</div>
<div>
</div>
</form>
答案 0 :(得分:0)
要获取选定的文本(或值),请添加`
(change)=“ selectchange($ event)”
`进行选择,然后像这样获得它:
selectchange(sel){
const value = sel.target.value;
const text = sel.target.options[sel.target.selectedIndex].text;
}