Get child element
<p>Please have a look at below code.</p>

<pre><code>import { Component,ViewChild,QueryList,ViewChildren } from '@angular/core'

@Component ({
selector : 'other-component',
template : `
          &lt;h2&gt;OtherComponent&lt;h2&gt;
          &lt;table #tab id="tab"&gt;
            &lt;tr *ngFor="let val of valArray"&gt;
              &lt;td&gt;{{val}}&lt;/td&gt;
              &lt;input type="checkbox" [value]="val"&gt;
            &lt;/tr&gt;
          &lt;/table&gt;
         &lt;button (click)="getChecked()"&gt;click me&lt;/button&gt;`
})
export class OtherComponent{
  valArray = ['one','two','three','four'];
  @ViewChild ('tab') elem;
  getChecked = () =&gt; {

    console.log (this.elem.nativeElement.children[0].children)
  }

}
</code></pre>

<p>At the end of the table row there is checkbox which has been assigned row value (JSON object) now I want to collect all the checked boxes in angular 2.</p>

<p>In plain javascript I can do this easily like below </p>

<pre><code>var yy = document.getElementById('tab').getElementsByTagName('input');
</code></pre>

<p>I got what I was looking for by  <code>this.elem.nativeElement.children[0].children</code></p>

<p>this gave me array of <strong>tr</strong> elements from which I got checked input boxes</p>

<p>Is there any better way to do this in angular 2?</p>