Angularjs ui路由器不显示默认状态url
查看启动它的ui路由器示例,我看到url:Angularjs ui路由器不显示默认状态url,angularjs,angular-ui-router,Angularjs,Angular Ui Router,查看启动它的ui路由器示例,我看到url: http://angular-ui.github.io/ui-router/sample/#/ 当我更改状态时: .state("home", { // Use a url of "/" to set a states as the "index". url: "/" 为此: .state("home", { // Use a url of "/" to set a states
http://angular-ui.github.io/ui-router/sample/#/
当我更改状态时:
.state("home", {
// Use a url of "/" to set a states as the "index".
url: "/"
为此:
.state("home", {
// Use a url of "/" to set a states as the "index".
url: "/home",
当我明确单击“主页”按钮时,我看到了这一点:
http://angular-ui.github.io/ui-router/sample/#/home
但当我最初加载演示应用程序时,我看到:
http://angular-ui.github.io/ui-router/sample/#/
为什么默认路由的加载不显示/home,而是显示/
但是当我点击主页按钮时,默认的url是“固定”的
我还想看到最初的/home您需要为$urlRouterProvider设置其他选项,如下所示:
app.config(function ($stateProvider, $urlRouterProvider, $injector) {
$urlRouterProvider.otherwise('/home');
$stateProvider.state('home', {
这将允许您设置除/之外的默认状态,只需感谢缺少“否则带回家”选项。