【发布时间】:2019-05-13 09:50:09
【问题描述】:
我的 HTML 中有一个 ID 为 footerWrapperTop 的 DIV。
我的组件中有以下 TypeScript:
ngAfterViewInit(): void {
try {
this.sFragment = 'footerWrapperTop';
const nativeElement = document.querySelector('#' + this.sFragment);
nativeElement.scrollIntoView();
} catch (e) { } }
但是页面在运行时不会向下滚动到页脚。我做错了什么?
如果我 console.dir(nativeElement); 它会在控制台中显示 DIV。
【问题讨论】:
标签: angular