当我点击快速导航时,我遇到了一个问题,锚标记替换了URL中的搜索参数。
'example.com/search?hash=1234'
变为'example.com/search#FAQ'
而不是'example.com/search?hash=1234#FAQ'
我该如何解决这个问题?1.1.5版
HTML锚定标签:
<a href="#{{page.id}}" ng-repeat="page in results.page">{{page.id}}</a>
如果有区别的话,我确实启用了HTML5模式:
.config(['$locationProvider', function($locationProvider){
$locationProvider.html5Mode(true).hashPrefix('!');
}]);
我现在使用了一个技巧性的解决方法:
<a ng-href="{{resultsHash}}#{{page.id}}" ng-repeat="page in results.page">{{page.id}}</a>
以及resultsHash
的值
$scope.resultsHash = "?hash=" + data.hash;
因此,每次他们使用quickNav链接时,哈希都会包含在路径中。这不是一个理想的解决方案。但它模仿了我想要做的事情。