我想知道是否有可能没有嵌套视图的嵌套状态.假设我有这个设置:
App.config(function($stateProvider, $urlRouterProvider) {
//
//
// Now set up the states
$stateProvider
.state('index', {
url: "/index",
templateUrl: "views/home.html",
controller: "MainController",
ncyBreadcrumb: {
label: 'Home'
}
})
.state('About', {
url: "/about",
templateUrl: "views/about.html",
controller: "AboutController",
ncyBreadcrumb: {
label: 'About',
parent: 'index'
}
})
.state('us', {
url: "/us",
templateUrl: "views/us.html",
controller: "UsController",
parent: 'about',
ncyBreadcrumb: {
label: 'Us'
}
})
//
// For any unmatched url, redirect to /home
$urlRouterProvider.otherwise("/index");
});
Run Code Online (Sandbox Code Playgroud)
当我访问时/about,我得到了关于页面.当我访问时/about/us,我仍然在about页面中加载了包含us页面ui-view的页面.但是,我想要做的是加载about页面,/about然后只打开us页面/us …