我正在使用ui-router使用ui-router,并且收到以下错误消息。UI路由器无法解析状态错误消息
Error: Could not resolve 'static.about' from state 'static'
我不知道为什么。我想要实现的是在我的应用程序中有2个部分,静态部分,主页,关于,登录,注册和应用程序端,这些会像仪表板,用户配置文件等,我认为我需要设置我的ui-这样的路由器,
app
.config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider){
// any unknown URLS go to 404
$urlRouterProvider.otherwise('/404');
// no route goes to index
$urlRouterProvider.when('', '/home');
// use a state provider for routing
$stateProvider
.state('static', {
url: '/home',
templateUrl: '',
views : {
header : {
templateUrl : 'app/components/shared/header.html'
},
main: {
templateUrl : 'app/components/home/views/home.view.html'
}
}
})
.state('static.about', {
// we'll add another state soon
url: '/about',
templateUrl: 'app/components/about/views/about.view.html',
})
.state('app', {
abstract: true,
templateUrl: ''
})
.state('app.dashboard', {
url: 'app/dashboard',
templateUrl : '',
})
}]);
但是,这会返回已经提到的错误。我想这样设置它的原因是,应用程序的两面也有非常不同的布局,所以我认为我应该能够将不同的布局插入我的?
然而,我遇到的最大的问题是错误,其次是链接正在生成,当我点击它应该去/ about,但是它会去/ home/about。
所有我想在早期阶段实现的是对我的“静态”的页面共享一个导航,并有可更换的主要部分,而对于“应用程序”页面有一个完全地新的布局/父模板