Get incorrect offsetWidth and offsetHeight values

后端 未结 3 2071
眼角桃花
眼角桃花 2021-02-08 06:36

Here is my angular2 code.

Template

3条回答
  •  粉色の甜心
    2021-02-08 07:05

    You have to schedule calls to 'offsetWidth' after rendering cycle, angular executes draw on the end of microtask queue, so you could try setTimeout(..., 0) or run Promise.resolve().then(...) outside of zonejs. Hope it helps.

提交回复
热议问题