This pure javascript made to work for Angular 4 is doing horizontal position detection of an item and scrolls to its position and small reposition, and sticking to its location when changing view by detecting the id of the item and scroll to it, so the element will be always visible in the view.
If you like this and you found useful you can contribute on my paypal kirilrap@aol.com
All THE BEST!