javascript - window.innerHeight incorrect even in ngAfterViewInit -


i'm having trouble getting window.innerheight correctly determined, in angular 4. need know height, because have 2 rows, , both fill screen, first row 140px or 30px, while second needs "fill rest".

i calc(100vh - 140) in css, since it's height changes 30px, can't css alone.

therefore, need solve in js/ts too.

the problem window.innerheight == 720 upon launch, if type console after launch, it's correct, it's lifecycle issue.

and indeed can solve issue with:

//put task on end of queue, can correct height. settimeout(() => { //so hacky, hate it!     this.resizeemail(); }, 0) 

however, don't "solution" @ all.

does know how correct height, without using settimeout?

i've tried putting code in ngoninit , ngafterviewinit , ngaftercontentinit.

thanks.

window.settimeout(function() {     //insert logic height or width calulations here. }, 200); 

this works 80% of time .orientation change needs delay pick on new heights , widths.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -