title: Angular 2 table : how to switch cases using keyboard arrows
body: <p>I am new to web development. I am making a Sudoku web app with Angular 2. I have implemented the table. However, I am not able to navigate through it with the keyboard arrows. </p>
  
  <p>Here is the app.component.html</p>
  
  <pre><code>&lt;body&gt;
  &lt;div class="container"&gt;
   &lt;div class="col-sm-6"&gt;
     &lt;table &gt;
               &lt;tr *ngFor="let row of cases" class='row'&gt; 
               &lt;td *ngFor="let case of row" class='case'&gt;&lt;input type="text" maxlength="1" arrowSelector&gt;
               &lt;/td&gt;
               &lt;/tr&gt;
  
    &lt;/table&gt;
   &lt;/div&gt;
  
  &lt;div class="col-sm-6"&gt;
      &lt;h3&gt;Chronometre: 11:32&lt;/h3&gt;
  
  &lt;/div&gt;
  &lt;div class="col-sm-2"&gt;
  
      &lt;button type="button" class="btn btn-primary btn-block"&gt;Nouvelle partie&lt;/button&gt;
      &lt;button type="button" class="btn btn-default btn-block"&gt;Réinitialiser partie&lt;/button&gt;
  
  
  &lt;/div&gt;
  &lt;div class="col-sm-6"&gt;
      &lt;h3&gt;Niveau de difficulté&lt;/h3&gt;
      &lt;button type="button" class="btn btn-success"&gt;Facile&lt;/button&gt;
      &lt;button type="button" class="btn btn-warning"&gt;Moyen&lt;/button&gt;
      &lt;button type="button" class="btn btn-danger"&gt;Difficile&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p>Here is the app.component.ts :</p>
  
  <pre><code>import { Component } from '@angular/core';
  
  import {ArrowSelectorDirective} from './arrowSelector.directive'
  
  
  
  @Component({
  
    selector: 'my-app',
  
    templateUrl: 'app/app.component.html',
  
    directives : [arrowSelector],
  
   })
  
  export class AppComponent {
  
    cases: number[][];
  
  
  
    constructor(){
  
  this.cases =[];
  
  for(var i: number =0; i&lt;9;i++){
  
    this.cases[i] = [];
  
    for(var j: number=0; j&lt;9;j++){
  
      this.cases[i].push(1);
  
    }
  
  }
  
    }
  
   }
  </code></pre>
  
  <p>I think I have to write a directive file but I'm not sure if it is the solution or how to do it.</p>
  
  <p>Thank you</p>