Angularjs Scroll to top With Router Autoscroll

Angularjs Scroll to top With Router Autoscroll

In this Post We Will Explain About is Angularjs Scroll to top With Router Autoscroll With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Scroll position after changing view – AngularJSExample

In this post we will show you Best way to implement Autoscroll to TOP with ui-router and Angularjs, hear for angularJS scroll to top after changing a viewwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Simple Solution : autoscroll=”true”

<div class="ng-view" autoscroll="true"></div>

Example 1 : Autoscroll to TOP with ui-router and Angularjs

<body id="page-top">

	<div ng-include src="'partials/header.html'"></div>

	<div ng-view="" id="ng-view" autoscroll="true"></div>

	<div ng-include src="'partials/footer.html'"></div>		
			
	<script src="app/js/angular.min.js"></script>
	<script src="app/js/angular-route.min.js"></script>
	<script src="app/app.js"></script>

</body>

Example 2 : Automatically Scroll To Top Of Page With UI-Router In AngularJS

in this example, to angularjs routing config to direct pages to onther pages to scroll to top and focus on first Section for HTML pages.

READ :  Angularjs math expression - number expressions Example

liveApp.run(function($rootScope, $window) {

  $rootScope.$on('$routeChangeSuccess', function () {

    var my_interval = setInterval(function(){
		//check condition
      if (document.readyState == 'complete') {
        $window.scrollTo(0, 0);
        clearInterval(my_interval);
      }
    }, 100);

  });
});

Example

I hope you have Got What is Automatically Scroll To Top Of Page With UI-Router In AngularJS And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Add a Comment

Your email address will not be published. Required fields are marked *