I am making single page website in which as soon as you click the tab it navigates to the respective div with scrolling. I found scrollTo jquery function for that. But my question is , is it possible to achieve the same effect with angularjs or is it possible to embed jquery inside angular code?
Asked
Active
Viewed 107 times
0
-
Did you check this? https://docs.angularjs.org/api/ng/service/$anchorScroll – mxr7350 May 17 '17 at 12:56
-
1possible duplicate http://stackoverflow.com/questions/17284005/scrollto-function-in-angularjs – Edwin May 17 '17 at 12:56
-
2Possible duplicate of [ScrollTo function in AngularJS](http://stackoverflow.com/questions/17284005/scrollto-function-in-angularjs) – urbz May 17 '17 at 12:56
1 Answers
1
An alternative to the scrollTo
jQuery function in Angular is the $anchorScroll
service.
For example, the following code will scroll to the first element with id="myElementId"
.
$location.hash('myElementId');
$anchorScroll();
Here is a demo Plunker

Mistalis
- 17,793
- 13
- 73
- 97
-
-
-
means, suppose I have three clickable tabs "x","y" and "z" .So as soon as I click "x" it should scroll to the divs related to x or when I automatically scroll to the div connected with x , it should show x highlighted – Mrugesh May 17 '17 at 14:13