title: Element width and height always return 0, but console.log(element) shows attributes ok, renders ok
body: <p>I was using Ionic 4 with Angular 7, with ViewChild.</p>
  
  <pre><code>&lt;ion-content&gt;
      &lt;ion-grid&gt;
          &lt;ion-row&gt;
              &lt;ion-col&gt;
                  &lt;div [hidden]="!toggle2D3D" id="zrenderCanvas" #zrenderCanvas&gt;&lt;/div&gt;
              &lt;/ion-col&gt;
          &lt;/ion-row&gt;
      &lt;/ion-grid&gt;
  &lt;/ion-content&gt;
  </code></pre>
  
  <p>scss like,</p>
  
  <pre><code>#zrenderCanvas {
    display: block;
    width: 100%;
    height  : 100%;
    touch-action: none;
  }
  </code></pre>
  
  <p>code like,</p>
  
  <pre><code>@ViewChild('zrenderCanvas', {read: ElementRef}) zrenderCanvas: ElementRef;
      private zrele: any;
  
  ...
  
  ngAfterViewInit() {
          // viewchild only works after view inited !
          this.zrele = this.zrenderCanvas.nativeElement;
          this.cdRef.detectChanges();
          console.log(this.zrele.offsetWidth); // this returns 0
          console.log(document.getElementById('zrenderCanvas').offsetWidth); // this return 0 too
          console.log(this.zrele); // however this show the object has a offsetWidth attribute, and it's not 0 !!! Why???
  ...
  }
  </code></pre>
  
  <p><strong>Update：</strong> </p>
  
  <p>I partially solved the issue by reference <a href="https://stackoverflow.com/a/294273/921082">https://stackoverflow.com/a/294273/921082</a> and <a href="https://stackoverflow.com/q/54235654/921082">MutationObserver: How to observe mutations in width/height of flex child?</a> and <a href="https://stackoverflow.com/a/51173985/921082">https://stackoverflow.com/a/51173985/921082</a>. It is the angular zone.js make the view init take longer than expected. I surround the get width line with setTimeout(,0), which make the statements run after zone.js, then I got the correct value. However by doing the setTimeout, one of my rxjs subscribe line inside the setTimeout function stops working. So I'd say it's partially solved. Any better idea?</p>