【发布时间】:2018-10-11 16:44:17
【问题描述】:
我参考了这个链接(NPM:@nicky-lenaers/ngx-scroll-to)和很多答案,但我没有得到完美的解决方案。当我点击按钮时,我的 div 页面(div 高度不固定,它可能非常)它只是向下滚动一点,但我想让页面在角度 6 中向下滚动到底部。任何其他解决方案或修改都适用。谢谢
chat.component.html
<div id="destination"> My Content is here</div>
<button (click)="getChatMessages()">SAVE</button>
chat.component.ts
import { ScrollToService, ScrollToConfigOptions } from '@nicky-lenaers/ngx-scroll-to';
constructor(private _scrollToService: ScrollToService) { }
getChatMessages(){
const config: ScrollToConfigOptions = {
target: 'destination'
};
this._scrollToService.scrollTo(config);
}
【问题讨论】: