我尝试使用 UI-Router 的多个命名视图,但它不起作用。
请参阅以下示例以了解我的问题:
开始.html
<body ng-app="startApp">
<div ui-view="navigation"></div>
<div ui-view="content"></div>
</body>
导航.html
<nav>
<ul>
<li>btn1</li>
<li>btn2</li>
</ul>
</nav>
内容.html
<h1>My content</h1>
应用程序.js
angular.module('startApp', ['ngAnimate', 'ui.router', 'ngFileUpload', 'ngImgCrop'])
.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('start', {
url: '/start',
templateUrl: 'pages/start/start.html',
controller: 'mainController'
})
.state('start.Why', {
url: '/Why',
views: {
'navigation@start': {
templateUrl: 'pages/start/nav.html'
},
'content@start': {
templateUrl: 'pages/start/content.html'
}
}
})
})
问题
无显示。ui-view 中没有注入任何内容。但是如果我的 ui-view 没有名称并且我的 id 视图''
不是'navigation@start'
它的工作:navigation.html是 display..
我尝试'@start'
有无。我无法解释是什么问题。我的 js 控制台很清楚。
你能帮我吗 ?