我是AngularJS的新手,我在渲染结果后使用$anchorScroll
滚动到页面的特定部分(工作正常)。
但是,我想隐藏浏览器中出现的锚点(请参阅下图)。我怎样才能做到这一点?
以下是我使用$anchorScroll
的控制器中的部分,以及用户点击提交后显示结果的位置。任何帮助将不胜感激:
$scope.SearchProvider = function(searchParam) {
try{
$scope.searchMode = 1;
var queryString='';
if($scope.formModel && $scope.formModel !== searchParam){
$scope.resultsCount = 0;
currentPage = 1;
}
if(searchParam){
$scope.formModel = searchParam;
for(var param in searchParam){
if(searchParam.hasOwnProperty(param)){
var paramValue = searchParam[param].value ? searchParam[param].value.trim() : searchParam[param].trim();
if (paramValue.length > 0)
queryString += param + '=' + paramValue + '&';
}
}
}
//debugger;
console.log(queryString);
queryString= '?' + queryString + 'currentpage=' + $scope.currentPage;
$http.get("/includes/ReturnProvidersList.cfm" + queryString)
.then(function(response){
$scope.providers = response.data.provider;
$scope.resultsCount = response.data.rowCount;
if (!$scope.providers){
$scope.NoResults = true;
$scope.ShowResults = false;
$scope.ShowDesc = false;
$location.hash('error');
// call $anchorScroll()
$anchorScroll('error');
}
else {
$scope.NoResults = false;
$scope.ShowResults = true;
$scope.ShowDesc = false;
$location.hash('ResultsAnchor');
// call $anchorScroll()
$anchorScroll('ResultsAnchor');
}
})
}
catch(err){ alert('No response.: ' + err.message); }
}