How to scrollTop a div whose content is managed by AngularDart?

前端 未结 3 2039
忘掉有多难
忘掉有多难 2021-01-21 13:56

I have a div holding some chat history. I would like for the div content to scroll when it becomes full. I have this working using jQuery in another p

3条回答
  •  轮回少年
    2021-01-21 14:40

    For the first issue you can use Timer.run to defer the scroll execution :

    Timer.run(() => elt.scrollTop = elt.scrollHeight);
    

    For the second issue you can inject the Element managed by your controller and use querySelector on it :

    MyController(Element e) : elt = e.querySelector('.chatHistory');
    

提交回复
热议问题