If you're ' re in a scenario where do you want to disable the auto scrolling, and you want to control the scrolling manually, you can use the Anchorscroll service, and then just invoke this after some hash have changed.
<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <title></title></Head><BodyNg-app= "Egghead"Ng-controller= "Appctrl as App"><aNg-click= "App.gotoanchor (Elm)"ng-repeat= "Elm in App.elms">{{Elm}}</a><DivID= "{{elm}}"Ng-style= "App.createstyle ($index)"ng-repeat= "Elm in App.elms">{{Elm}}</Div><Scriptsrc= "//cdn.jsdelivr.net/tinycolor/0.9.16/tinycolor.js"></Script><Scriptsrc= "Https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></Script><Scriptsrc= "App.js"></Script></Body></HTML>
varApp = Angular.module ("Egghead", []); app. Config (function($anchorScrollProvider) {$anchorScrollProvider. disableautoscrolling ();}) App.controller ("Appctrl",function($location, $anchorScroll) {varApp = This; App.elms= "ABCDEFGHIJKLMNOPQRSTUVWXYZ". Split (""); //https://github.com/bgrins/TinyColor#color-combinations varcolors = tinycolor.analogous ("Steelblue", App.elms.length, app.elms.length); App.gotoanchor=function(Elm) {$location. hash (ELM);
//call when the It scroll $anchorScroll (); } App.createstyle=function(index) {varcolor = Colors[index];//grabs a tinycolor of the array return{backgroundColor:color.toHexString (), BorderBottom:"3px solid Black", Height:"100px" }; }})
[AngularJS] Using $anchorScroll