从文档和另一个例子来看,我似乎正确地使用了这个。但是,在Chrome控制台中,我收到错误消息: $ anchorScroll未定义。
触发此操作的click函数位于以下代码中,名为viewBugForm()。
feedbackModule.controller('feedbackController', ['$scope', '$timeout','$location','commonService',
function ($scope, $timeout, $location, commonService) {
scroll = () => {
$timeout(() => {
$location.hash('bug-form');
$anchorScroll();
});
}
$scope.viewBugForm = (type) =>
{
scroll();
}
这是锚:
<a id="bug-form"></a>
坦率地说,我找不到任何错误。我已经尝试过,有没有超时。
有什么想法吗?
由于
答案 0 :(得分:1)
未导入$ anchorScroll
愚蠢的错误。我以为它来自$ location