title: Read data from table inputs in Angular2
body: <p>I want to make a table with inputs and read data from it. 
  At the moment I have this:</p>
  
  <p><img src="https://i.stack.imgur.com/KuDZE.png" alt="My table"></p>
  
  <p>I want to display each letter separately, but for now if I type in first cell of first row, it writes "0": "v", second cell of first row "0": "i",...and as shown in my example fifth cell of first row: "0": "e", but what I want to have is id for each cell, so it must be something like:</p>
  
  <pre><code>"0": "v",
  "1": "i",
  "2": "e",
  "3": "l",
  "4": "e",
  "5": " ",
  "6": " ",
  "7": " ",
  ...
  "29": " ",
  </code></pre>
  
  <p>Could you please help, I hit the wall, and I don't know how to do it...</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import { Component, OnInit, ViewChildren,
    Input, Directive, TemplateRef, ViewContainerRef } from '@angular/core';
  
  import { DataService } from '../sample02-simpleService/data.service';
  
  @Component({
    moduleId: module.id,
    selector: 'part1',
    template: `
      &lt;div&gt;
      &lt;form #f="ngForm" (ngSubmit)="onSubmit(f)"&gt;
        &lt;table&gt;
  
          &lt;tr *ngFor="let item of itemsSource; let i = index;"&gt;
  
            &lt;td *biRepeat="count"&gt;
           &lt;input name="{{i}}" ngModel #prix="ngModel" [id]="i" /&gt;
            &lt;/td&gt;
            {{item}}
          &lt;/tr&gt;
        &lt;/table&gt;
      &lt;/form&gt;
        &lt;pre&gt;{{f.value | json}}&lt;/pre&gt;
      &lt;/div&gt;
  
  
    `,
    // styleUrls: ['app/part1/part1.component.css'],
    providers: [DataService]
  
  })
  export class Part1Component implements OnInit {
    count: number;
  
    @ViewChildren ('prix') inputs;
    public itemsSource: string[];
    constructor(public dataService: DataService) {
      this.count = 6;
    }
    ngOnInit() {
      this.itemsSource = this.dataService.getData();
    }
  
  @Directive({ selector: '[biRepeat]' })
  export class RepeatDirective {
  
    constructor( private templateRef: TemplateRef&lt;any&gt;,
                 private viewContainer: ViewContainerRef) { }
    @Input('biRepeat') set count(c: number) {
      this.viewContainer.clear();
      for (let i = 0; i &lt; c; i ++) {
        this.viewContainer.createEmbeddedView(this.templateRef);
      }
    }
  }
  </code></pre>