【发布时间】:2014-08-08 19:03:40
【问题描述】:
我正在尝试从一个页面重定向到另一个页面。每个页面都有自己的控制器。
我愿意
.controller('HomeCtrl', function ($scope, $location) {
$scope.settings = Helper.getLS('settings');
if (!$scope.settings) $location.path("/app/settings");
console.log('why am i seeing this?');
...
网址正在更改,但问题是我仍然可以在控制台中看到日志,并且此页面中的其余功能仍在运行
我想停止执行并重定向并在新页面上运行另一个控制器
有什么想法吗?
【问题讨论】:
-
你需要
return;就行了if (!$scope.settings) return $location.path("/app/settings"); -
该死,你是对的。您可以发布回复并不接受它
标签: javascript angularjs location url-redirection