Key up down in Angular 2 \ 4 table

Viewed 9518

How can I write a functionality for key up and key down, across the table cells in Angular? (just like how we would move the keys using up and down arrow keys across the cells in an excel sheet).

This is the code I have: http://plnkr.co/edit/vk937A1VWNPIFQYkoPsM?p=preview

<table>
      <thead>
            <tr>
                 <th class="under-below" *ngFor="let col of columns">{{col.display}}</th>
            </tr>
        </thead>

        <tbody>
            <tr *ngFor="let row of rows">
                <td *ngFor="let col of columns">

                <div *ngIf="!col.editable">{{colLabelFunction(row, col)}}</div>
                <input type="text" value="{{colLabelFunction(row, col)}}" *ngIf="col.editable">

                </td>

            </tr>


        </tbody>
      </table>

I want to move up and down on the 'Column 2' text inputs ( cells ), using keyup and keydown keys.

1 Answers
Related