gpt4 book ai didi

AngularJS 强制应用程序从特定 URL 启动

转载 作者:行者123 更新时间:2023-12-02 10:02:53 26 4
gpt4 key购买 nike

我的应用程序中有一个特定的逻辑序列,我想要一种简单的方法来强制我的应用程序从欢迎页面启动。我正在使用这个:

$urlRouterProvider.otherwise('/pages/welcome');

问题是否则只是使用未知的URL并将它们重定向到welcome,而我想重定向到welcome在所有情况下,即使在注册州也是如此。

最佳答案

只需尝试 location.hash = '#/'; 如下所示:

angular.module('app', []).config(function ($stateProvider, $urlRouterProvider) {

location.hash = '#/';

$stateProvider
.state('welcome', {
url : '/pages/welcome',
templateUrl: 'views/welcome.html',
controller : 'WelcomeCtrl'
});

// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/pages/welcome');
})

关于AngularJS 强制应用程序从特定 URL 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34039989/

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