使用以下代码,我正在尝试使用url / admin创建一个页面,在单击按钮后单击另一个按钮到/ admin / devices / new后会引导您进入/ admin / devices。第一部分正常工作,我被重定向到/ admin / devices。第二部分不完全,因为它将url更改为/ admin / devices / new,但它不会更改模板。
要更改网址,我使用$state.go(admin.devices)
和$state.go(admin.devices.new)
有什么想法吗?
$stateProvider
.state('admin', {
url: '/users',
abstract: true
})
.state('admin.devices', {
url: '/devices',
template: require('../templates/admin/devices/index.html'),
controller: 'AdminDevicesCtrl',
controllerAs: 'ctrl'
})
.state('admin.devices.new', {
url: '/new',
template: require('../templates/admin/devices/new.html'),
controller: 'AdminDevicesNewCtrl',
controllerAs: 'ctrl'
});