title: what is the equevalant for getelementbyid in angular 2
body: <p>javascript code...</p>
  
  <pre><code>&lt;div&gt;
  &lt;canvas #layout width="800" height="600"&gt;this is not working&lt;/canvas&gt;
  code here...
  &lt;/div&gt;
  
  &lt;script&gt;
  function myFunction() {
  document.getElementById("layout")
  }
  </code></pre>
  
  <p></p>
  
  <p>in angular
  app.component.html...</p>
  
  <pre><code>&lt;canvas #layout width="800" height="600"&gt;this is not working&lt;/canvas&gt;
  </code></pre>
  
  <p>app.component.ts...</p>
  
  <pre><code>@ViewChild('layout') canvas;
   ngOnInit() {
  
    const _canvas = this.canvas.nativeElement;
    ....
    }
  </code></pre>