1
我有這個表我TableComponent
內:Angular2:進去組件的HTML元素的引用,然後滾動到頂部是html元素
<table #trackerTable>
我想滾動到它的上面,當有事情發生,所以我試着中引用,在我的TableComponent
:
@ViewChild("trackerTable") trackerTable;
當myMethod()
被觸發我嘗試scrollTo(0,0)
:
public myMethod() {
this.trackerTable.scrollTo(0,0); // TypeError: this.trackerTable.scrollTo is not a function
}
,但我得到的錯誤:TypeError: this.trackerTable.scrollTo is not a function