'Setting a CSS Id property inside ngOnInit not working in the browser

I'm having a little issue with setting a property height.

In my ngOnInit method I have this code below. When I step through it I can see the value of the property change in the console, but there's no change on screen or in the debugger. I also tried running this inside AfterViewInit but that didn't seem to do anything as well.

FYI - If I create a button and trigger it manually on the page I can make the change, it just doesn't work inside ngOnInit.

Any any one tell me why or if I'm doing something incorrectly?

ngOnInit(): void {
  if (something) {
    document.getElementById('map-full').style.setProperty('height', 'calc(100vh - 57px)');
  } else {
    document.getElementById('map-full').style.setProperty('height', 'calc(100vh - 105px)');
  }
}
<div id="map-full">


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source