我有以下代码:
$stateProvider.state('dm', {
template: '<div ui-view></div>'
}).state('dm.start', {
url: '/',
templateUrl: 'test.html'
}).state('dm.view', {
url: '/view',
template: '<div ui-view></div>',
controller: 'ViewCtrl',
controllerAs: "$ctrl"
}).state('dm.view.deposit', {
url: '/deposit',
templateUrl: 'components/view/view_deposit.html'
}).state('dm.view.lot', {
url: '/lot',
templateUrl: 'components/view/view_lot.html'
}).state('dm.add', {
url: '/add',
template: '<div ui-view></div>',
controller: 'AddCtrl',
controllerAs: "$ctrl"
}).state('dm.add.deposit', {
url: '/deposit',
templateUrl: 'components/add/add_deposit.html'
}).state('dm.add.lot', {
url: '/lot',
templateUrl: 'components/add/add_lot.html'
}).state('dm.add.lot.main', {
url: '/:id',
templateUrl: 'components/add/add_lot_main.html',
controller: 'AddLotMainCtrl',
controllerAs: "$ctrl"
});
当我尝试导航到添加/ lot / 1234时,它显示在URL框中但我得到页面components / add / add_lot.html。我如何进入components / add / add_lot_main.html?
答案 0 :(得分:0)
所有设置似乎都可以。确保,该模板'components/add/add_lot.html'
确实包含其子项目标
<div ui-view=""></div>
答案 1 :(得分:0)
尝试更改为lot /:id
的网址<强> JS 强>
.state('dm.add.lot.main', {
url: '/lot/:id',
templateUrl: 'components/add/add_lot_main.html',
controller: 'AddLotMainCtrl',
controllerAs: "$ctrl"
});
这将解决它。