Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/462.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript (单击)功能未在chrome angular 6中触发_Javascript_Html_Angular_Typescript_Google Chrome - Fatal编程技术网

Javascript (单击)功能未在chrome angular 6中触发

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

(单击)当我使用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 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()函数是,但在该函数中要执行的操作是,因为您也可以在更改选择事件时执行操作。我猜缺少一个空格:”