[英]AngularJS UI-Router “otherwise” state not loading
我的index.html页面具有3个视图:
<header ui-view="header"></header>
<main ui-view="content"></main>
<footer ui-view="footer"></footer>
我只是将站点更改为使用这3个视图,而不是最初的单个视图。
我的应用程序中的所有路由都可以正常工作,例如“ home”视图:
$stateProvider.state('home', {
url: '/home',
data: {
pageTitle: 'Home',
access: 'private',
bodyClass: 'home'
},
views: {
'header': {
templateUrl: 'modules/header/header.html'
},
'content': {
controller: 'HomeController as home',
templateUrl: 'modules/home/templates/home.html'
},
'footer': {
templateUrl: 'modules/footer/footer.html'
}
}
});
我的问题是应用程序中的“其他”状态无法正确加载“原位”状态。 该页面为空白,没有控制台错误。 这是我的app.module中的状态:
angular.module('app').config(function ($stateProvider) {
$stateProvider.state('otherwise', {
url: '*path',
template: '',
data: {
pageTitle: '',
access: 'public',
bodyClass: ''
},
controller: function ($state) {
$state.go('home');
}
});
});
我在这里想念什么?
我不确定您的野生字符是否有效。
理想情况下,我将以下内容用于默认路由:
$urlRouterProvider.otherwise('/app/home');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.