gpt4 book ai didi

javascript - X 秒后重定向 AngularJS

转载 作者:行者123 更新时间:2023-11-28 18:58:34 24 4
gpt4 key购买 nike

我已经看到了这个thread但它使用 ui-router 而我只使用 AngularJS 的 $routeProvider 。线程中的代码是:

.controller('SeeYouSoonCtrl', ['$scope', '$state', '$timeout',
function($scope, $state, $timeout) {

$timeout(function() {
$state.go('AnotherState');
}, 3000);

}])

由于我没有使用 ui-router,如何将它与我的 routeProvider 一起使用?预先感谢您。

最佳答案

您需要使用$location服务

$location.path('/anotherURL');

关于javascript - X 秒后重定向 AngularJS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33075122/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com