AngularJS - How to query the DOM when directive rendering is complete

前端 未结 2 1632
一个人的身影
一个人的身影 2020-12-10 00:18

I\'m trying to implement a custom scroll pane component using an AngularJS directive. in the following jsfiddle example I have an example of the basic prototype.

her

2条回答
  •  -上瘾入骨i
    2020-12-10 01:04

    See is there a post render callback for Angular JS directive?

    Unfortunately, there is no way to determine when rendering is complete (e.g., there is no event). Using $timeout seems to be the best workaround available.

    In the link above, @Nik mentioned in a comment that he was checking $('tr').length > 3, for his particular scenario, to determine when rendering was complete. Maybe there is something you could periodically examine in the DOM to determine that rendering is complete.

提交回复
热议问题