title: Angular 4 set the focus in the dynamic generated textbox using viewChildran
body: <p>I have the dynamically generated textbox as below.</p>
  
  <pre><code>&lt;tr *ngFor="let item of data; let in=index"&gt;
      &lt;td&gt;
                          &lt;input #unitNumber type="text" name="workPerformed-workcode-{{in}}" [(ngModel)] = "item.unitnumber" &gt;
                        &lt;/td&gt;
  &lt;td&gt; &lt;!-- Search option is given to chose the unit number----&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Here, the search option is given to choose the unit number, if it has been chosen, then the corresponding textbox will be focused on using viewChildran.</p>
  
  <p><strong>My try is</strong></p>
  
  <pre><code>@ViewChildren('unitNumber') enteredUnitNumbers;
  
  // for searching, I have used the material dialog box
  const dialogRef = this.dialog.open(SearchEquipmentComponent, dialogConfig);
  
      dialogRef.afterClosed().subscribe(
        &lt;!-- HERE I NEED TO DO THE FOCUS ON PARTICULAR TEXTBOX ----&gt;
       // console.log(this.enteredUnitNumbers.toArray().map(x =&gt; x))
  });
  </code></pre>
  
  <p>Above console.log shows undefined. My need is that once dialog box is closed the corresponding unit number textbox should be focused.</p>
  
  <p>Kindly give solutions </p>