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?
Asked
Active
Viewed 246 times
0
-
have you tried getting the page to scroll? i recall there being a scrollTo() method – mast3rd3mon Dec 05 '17 at 09:51
-
Could you please provide the sample code? – Hashim Dec 05 '17 at 10:18
-
try: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView or see the acepted answer on: https://stackoverflow.com/questions/635706/how-to-scroll-to-an-element-inside-a-div – mast3rd3mon Dec 05 '17 at 10:31
1 Answers
0
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.

mukund patel
- 1,039
- 10
- 31