【发布时间】:2016-02-18 09:27:00
【问题描述】:
我仍然面临这个问题。我的问题有点不同
我在其他事件中调用我的 $anchorScroll 函数。提交表单时。它正在第二次单击与上述相同。我也尝试过较早的anwsered解决方案,但没有运气:(
$scope.scrollTo = function(element) {
var old = $location.hash();
$location.hash(element);
$anchorScroll();
$( 'html, body').animate({
scrollTop: $(element).offset().top
}, 1000);
$location.hash(old);
};
我在另一个提交表单的函数中调用它。
$scope.saveProfile = function (profile) {
$log.debug("now the profile is " + JSON.stringify(profile));
dataFactory.persistChange("profiles",profile,$scope,postSuccessUpdate);
$scope.scrollTo( "#error ");
}
这是我的锚
<div ng-class="statusDisplayClass" ng-show="messages" id="error">
Here it will be displayed
</div>
请帮助我。我缺乏的地方。
【问题讨论】:
标签: javascript angularjs nested location