according to angularjs 1.x the js file:
angular.module('ur-ng-app').run(['$anchorScroll', function ($anchorScroll) {
$anchorScroll.yOffset = 70; // always scroll by 50 extra pixels
}])
.controller('ur-controller', ['$anchorScroll', '$location', '$scope',
function ($anchorScroll, $location, $scope) {
$scope.gotoAnchor = function (x) {
var newHash = 'anchor' + x;
var old = $location.hash();
if ($location.hash() !== newHash) {
$location.hash('anchor' + x);
$anchorScroll(newHash);
$location.hash(old);
} else {
$anchorScroll(newHash);
$location.hash(old);
}
};
}
]);
html file:
<div class="well">
<div class="container" ng-controller="ur-controller">
<a ng-click="gotoAnchor(1)">Accordion</a>
<a ng-click="gotoAnchor(2)">Alert</a>
</div>
<div id="anchor1" class="col-md-12 portlets ui-sortable">
<div class="panel">
<div ng-include="'sample'"></div>
</div>
</div>
<div id="anchor2" class="col-md-12 portlets ui-sortable">
<div class="panel">
<div ng-include="'sample'"></div>
</div>
</div>
<div id="anchor3" class="col-md-12 portlets ui-sortable">
<div class="panel">
<div ng-include="'sample'"></div>
</div>
</div>
</div>