gpt4 book ai didi

javascript - Ionic/Angular $urlRouterProvider.otherwise 问题

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

我在使用 Ionic/Angular 时遇到问题。我是 ionic 新手,需要一些帮助。网上的大部分内容都是针对启动画面的,所以我来这里寻求进一步的帮助。

我希望应用程序默认登陆“欢迎”页面。我需要写什么?我的代码如下。

angular.module('starter', ['ionic', 'starter.controllers'])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})

.config(function($stateProvider, $urlRouterProvider) {
$stateProvider

.state('app', {
url: "/app",
abstract: true,
templateUrl: "templates/menu.html",
controller: 'AppCtrl'
})

.state('app.welcome', {
url: "/welcome",
views: {
'menuContent': {
templateUrl: "templates/welcome.html"
}
}
})

.state('app.bulletin', {
url: "/bulletin",
views: {
'menuContent': {
templateUrl: "templates/bulletin.html"
}
}
})
.state('app.lunch', {
url: "/lunch",
views: {
'menuContent': {
templateUrl: "templates/lunch.html"
}
}
})
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise("/app/welcome");
});

最佳答案

我认为你需要删除});位于 $urlRouterProvider 之上,因为您必须在配置中定义 else() ;

app.config(function($urlRouterProvider){
// if the path doesn't match any of the urls you configured
// otherwise will take care of routing the user to the specified url
$urlRouterProvider.otherwise('/index');
})

关于javascript - Ionic/Angular $urlRouterProvider.otherwise 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29199341/

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