3.4. Set HEIGHT, get HEIGHT - quan1997ap/angular-app-note GitHub Wiki

import {Component, ElementRef, AfterViewInit, QueryList, ViewChild, ViewChildren} from '@angular/core';

@Component({
  selector: 'app-something',
  templateUrl: '<section #fa1><div #fa1View></div><div #fa1View></div></section>',
  styleUrls: ['']
})
export class AppComponent implements AfterViewInit {
  @ViewChild('fa1') fa1: ElementRef;
  @ViewChildren('fa1View') fa1Views: QueryList<ElementRef>;
  
  ngAfterViewInit() {
    this.viewHeight = window.innerHeight - document.getElementById('parrent-Element').offsetTop;    // get max height
    this.fa1.nativeElement.style.height = this.viewHeight + 'px';    // set height
    for (let l = 0; l < this.fa1Views.toArray().length; l++) {
      this.fa1Views.toArray()[l].nativeElement.style.height = this.viewHeight + 'px';
    }
  }
⚠️ **GitHub.com Fallback** ⚠️