title: Angular 5 access divs list using @ViewChildren
body: <p>I want to fetch all divs starting with the id 'div'. To do so, i use @ViewChildren but i'm not able to access the divs because i have an empty array , why ?</p>
  
  <p>My template</p>
  
  <pre><code>&lt;div id="div-1"&gt;Div 1&lt;/div&gt;
  &lt;div id="div-2"&gt;Div 2&lt;/div&gt;
  &lt;input type="button" (click)="getDivs()"&gt;
  </code></pre>
  
  <p>Component</p>
  
  <pre><code>@ViewChildren('div') divs: QueryList&lt;any&gt;;
  divList : any[];
  
  getDivs(){ 
     this.divList = this.divs.filter(x =&gt; x.id.lastIndexOf('div-', 0) === 0);  
     console.log(this.divList);  
        // this.divList return an empty array but i should have two results  
  }
  </code></pre>