AngularJS 部分:
myApp.config(['$routeProvider','$locationProvider',function($routeProvider,$locationProvider) {
$routeProvider.
when('/main', {templateUrl: 'sub/main.tpl', controller: MainCtrl}).
when('/users', {templateUrl: 'sub/users.tpl', controller: UserCtrl}).
otherwise({redirectTo: '/main'});
}]);
和我的 index.html
<a href="#/main">Main</a> | <a href="#/users">Display Users</a>
<div ng-view></div>
它工作得很好,但我遇到了哈希问题。
当我尝试使用锚时,即:
<a href="#test">test</a>
当我单击此锚点时,它正在调用主页。
当我们使用 ng-view 时是否有可能摆脱散列?