我得到了以下代码
<mat-form-field appearance="fill" style="margin: 0px 20px;font-size:13px;">
<input matInput type="text" aria-label="Number" placeholder="{{'Home.search' | translate }}"
[formControl]="myControl" [matAutocomplete]="auto" (ngModelChange)="getByKeyword($event)">
<mat-option *ngFor="let testCity of testCities" [value]="testCity.city"
(click)="testFunction(testCity.city, testCity.countryIso, testCity.cityId)">
我想知道,有没有一种方法可以在没有(单击)的情况下调用“testFunction”,而是使用检测到输入字段不再悬停或输入每个新字母实例的东西?
使用“mouseleave”事件(与“click”相同)在停止悬停时执行功能。为了检测打字,您可以使用“keydown”或“keyup”事件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句