Trying to get a horizontal scrollable div to automatically scroll

I have a horizontal scroll div that is contained in a directive where the directive is placed in a view. When adding elements to my scrollable div, I want to always scroll to the end of the div. I am trying to do this by putting id in the element I want to scroll through and setting $ location.hash ('myElementId'). Then I call $ scrollToAnchor ().

I see two problems. Firstly, I was not able to do this job at all, and I wonder if $ scrollToAnchor () works for horizontally scrollable areas. Secondly, the call to $ scrollToAnchor () apparently calls the controller () function of my view to run again with all the controller functions () of any directive contained in the view, which in fact led to everything in the view redrawing that is not my intention.

Is there a way to cause scrolling only for a specific scrollable div? Does $ ScrollToAnchor () cause a “refresh” of the design view?

thank

+3
source share

All Articles