var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope, $location, $anchorScroll) {
$scope.gotoBottom = function() {
// set the location.hash to the id of
// the element you wish to scroll to.
$location.hash('bottom');
// call $anchorScroll()
$anchorScroll();
};
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.5.x" src="https://code.angularjs.org/1.5.8/angular.js" data-semver="1.5.8"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<input type="button" value="Go to bottom" ng-click="gotoBottom()" />
<div class='main'>
<h1>A really tall div</h1>
</div>
<a id="bottom"></a>
<h2>after main div</h2>
</body>
</html>
/* Put your css in here */
.main {
height:1000px;
/*background-color:blue;*/
border: dashed black 2px;
}