angular ui 路由错误,因为抽象 =true 时无法从状态解析 'Employee.root'
angular ui route Error as Could not resolve 'Employee.root' from state when abstract =true
为什么我收到此错误无法从状态中解析 'Employee.root'
当我使用 abstract true 时。
<body ng-app="SuperApp">
<li><a ui-sref="Employee.root()">Employees</a></li>
.js代码
app.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$urlRouterProvider.otherwise('/')
$stateProvider
.state('root', {
abstract:true,
views:{
'@':{
templateUrl: '/Kpmg/Dummy/_LayoutPage.html'
}
}
})
$stateProvider.state('root.Employee', {
url: 'contact',
templateUrl: '/Kpmg/Dummy/someOther/Contact1.html',
controller: 'abc'
})
Contact1.html
<div ng-controller="abc">
<h3>This is Contact</h3>
</div>
<div ui-view></div>
应该是
<li><a ui-sref="root.Employee">Employees</a></li>
为什么我收到此错误无法从状态中解析 'Employee.root' 当我使用 abstract true 时。
<body ng-app="SuperApp">
<li><a ui-sref="Employee.root()">Employees</a></li>
.js代码
app.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$urlRouterProvider.otherwise('/')
$stateProvider
.state('root', {
abstract:true,
views:{
'@':{
templateUrl: '/Kpmg/Dummy/_LayoutPage.html'
}
}
})
$stateProvider.state('root.Employee', {
url: 'contact',
templateUrl: '/Kpmg/Dummy/someOther/Contact1.html',
controller: 'abc'
})
Contact1.html
<div ng-controller="abc">
<h3>This is Contact</h3>
</div>
<div ui-view></div>
应该是
<li><a ui-sref="root.Employee">Employees</a></li>