I have list of elements:
<div class="List">
<div class=" SearchListItem" [ngClass]="{ active: i == activeIndexResultItem }"
*ngFor="let item of searchShortResultItems; let i = index"
(mouseenter)="mouseEnterItem($event, i)" (keydown.enter)="searchByEnter($event, item)"
(click)="selectSearchResult(item)"> {{ item.text }}
</div>
</div>
Why (keydown.enter)
does not work?
searchByEnter(e, item) {
console.log(e); // no invoke
}
Also I have tried to change to:
(keydown)="searchByEnter($event, item)"
The same result
Also I havea set focus on: <div
class="List"#searchList>
:
if (this.searchList) {
setTimeout(() => this.searchList.nativeElement.focus(), 50);
}