我只想滚动到同一页面上的元素,但是当我使用$ anchorScroll服务时,它会调用路径,这就是我在控制器中的内容:
BIControllers.controller('ParentCtrl',['$scope', '$location', '$anchorScroll',
function ($scope, $location, $anchorScroll, DataService) {
$scope.showInformation = function () {
$location.hash('Info');
$anchorScroll();
};
}]);
这是锚标记:
<a ng-click="showInformation()">Info</a>
答案 0 :(得分:0)
<a ng-click="showInformation()" id="Info">Info</a>
使用它。在这里你需要使用id attr通过javascript识别。