我正在使用离子框架构建一个应用程序。我有一些嵌套状态,其中包含可以链接的侧菜单。问题是当我在#/cards/overview 时,我无法链接到#/promos/overview。这适用于离子服务,但不适用于安装在设备上。
angular.module('CLP', ['ionic', 'ngCordova', 'utils'])
.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/cards/overview');
$stateProvider
.state('promos', {
abstract : true,
templateUrl: 'templates/promos/promos.html'
})
.state('promos.main', {
abstract : true,
url: '/promos',
views: {
sidebarLeft: {
templateUrl: 'templates/sidebar/left.html'
},
mainContent: {
template: '<ion-nav-view></ion-nav-view>'
}
}
})
.state('promos.main.overview', {
cache : false,
url: '/overview',
templateUrl: 'templates/promos/overview.html'
})
.state('cards', {
abstract : true,
templateUrl: 'templates/cards/cards.html',
})
.state('cards.main', {
abstract : true,
url: '/cards',
views : {
sidebarLeft: {
templateUrl: 'templates/sidebar/left.html',
controller: 'sidebarCtrl'
},
mainContent: {
template: '<ion-nav-view></ion-nav-view>'
}
}
})
.state('cards.main.overview', {
cache : false,
url: '/overview',
templateUrl: 'templates/cards/overview.html',
controller: 'cardsOverview'
})
.state('cards.main.detail', {
cache : false,
url: '/:cardId',
templateUrl: 'templates/cards/detail.html',
controller: 'showDetail'
})
})
我试图创建一个 CodePen,尽可能好 http://codepen.io/Gothematic/pen/OPBJEW