You could do it like this:
<button (click)="scroll(target)"></button>
<div #target>Your target</div>
and then in your component:
scroll(el: HTMLElement) {
el.scrollIntoView();
}
or
<div id="editContent">gfjsdgfjs<br/>zvncvznbv</div>In component sidevar elmnt = document.getElementById("editContent"); elmnt.scrollIntoView();
No comments:
Post a Comment