0

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?

Mistalis
  • 17,145
  • 13
  • 72
  • 95
Mrugesh Thaker
  • 3,943
  • 7
  • 35
  • 76
  • Did you check this? https://docs.angularjs.org/api/ng/service/$anchorScroll – mxr7350 May 17 '17 at 12:56
  • 1
    possible duplicate http://stackoverflow.com/questions/17284005/scrollto-function-in-angularjs – Edwin May 17 '17 at 12:56
  • 2
    Possible duplicate of [ScrollTo function in AngularJS](http://stackoverflow.com/questions/17284005/scrollto-function-in-angularjs) – urbz May 17 '17 at 12:56

1 Answers1

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,145
  • 13
  • 72
  • 95