告诉Angular Js忽略特定路线

Dav*_*ves 39 angularjs

我在Angular中设置了路由,一切正常:

$locationProvider.html5Mode(true);
$routeProvider.
      when('/', { templateUrl: '/Home/Index' }).
      when('/User', { templateUrl: '/User/Index' });
Run Code Online (Sandbox Code Playgroud)

但是我现在有一个锚标记作为注销按钮,它只是将用户重定向到/ User/Logout,然后注销将用户注销并将它们重定向到登录页面.所以我想要的是角度js只是忽略这个特定的路由,并允许它做一个正常的http重定向.这似乎应该是非常简单的东西,但我无法找到问题的解决方案.

我知道我可以做一个click事件并在click事件中进行window.location更改,但这似乎是一种非常hacky方式.

ako*_*nsu 103

target="_self"在你的锚点中指定,以便angularjs不会重写URL.请参阅此处的讨论:http://docs.angularjs.org/guide/$location