Javascript (单击)功能未在chrome angular 6中触发
(单击)当我使用google chrome时,功能不会在我的选择标签中触发,但它在mozila中工作 这是我的密码Javascript (单击)功能未在chrome angular 6中触发,javascript,html,angular,typescript,google-chrome,Javascript,Html,Angular,Typescript,Google Chrome,(单击)当我使用google chrome时,功能不会在我的选择标签中触发,但它在mozila中工作 这是我的密码 <div class="col-xl-4 col-lg-9"> <select formControlName="deptId" class="form-control m-input" > <option>SELECT</option> <option *ngFor="let item of listA
<div class="col-xl-4 col-lg-9">
<select formControlName="deptId" class="form-control m-input" >
<option>SELECT</option>
<option *ngFor="let item of listAllDepartment" (click)="getdoctorlistid(item.dept_id)" value={{item.dept_id}}>{{item.dept_name}}</option>
</select>
</div>
挑选
{{item.dept_name}
谢谢您应该将ngModelChange与select一起使用,而不是单击
<selectformControlName="deptId" class="form-control m-input" [(ngModel)]="itemSelected" (ngModelChange)="getdoctorlistid(itemSelected)">
您无法将此类事件添加到
你可以加上
<select
[(ngModel)]="selectedItem"
(ngModelChange)="getdoctorlistid(selectedItem)">
<option>SELECT</option>
<option
*ngFor="let item of listAllDepartment"
(click)="getdoctorlistid(item.dept_id)"
value={{item.dept_id}}>
{{item.dept_name}}
</option>
</select>
挑选
{{item.dept_name}
编辑:如@Sajeetharan回答了单击特定选项时要执行的操作。我想调用getdoctorlistid()函数是,但在该函数中要执行的操作是,因为您也可以在更改选择事件时执行操作。我猜缺少一个空格:”