Angular 2: check if shift key is down when an element is clicked

Discussão em 'Angular' iniciado por totoro, Janeiro 17, 2025.

  1. totoro

    totoro Guest

    In an Angular 2 app, i want the click event to trigger something different when the shift key is being held down. how to achieve this?

    html is below:

    <div class="item" *ngFor="#obj of available" (click)="toggleSelected(obj)"></div>


    and i want to do something like this:

    toggleSelected(obj) {
    if(shift is pressed) {
    do this
    } else {
    do that
    }
    }


    so how can i detect if shift key is pressed? thanks!

    Continue reading...

Compartilhe esta Página