简体   繁体   中英

In Angular 2, how can I focus to the bottom of a div on button click

I have a div with lot of components. On button click, the focus should reach to the bottom of the div. How is it possible in Angular 2?

Use viewchild and nativeelement. Then you will get an element, and you will able to use .focus() method. follow viewchild and nativeelement. https://stackoverflow.com/a/45344187/4834833 It will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM