我有這樣的項目結構:AngularJS UI路由器無法加載templateUrl
的index.html
<html>
<head></head>
<body ng-app="myApp">
<div ui-view=""></div>
</body>
</html>
bread.html
<div class="col-md-12">
This is the bread view.
<div ui-view="filters"></div>
<div ui-view="tabledata"></div>
<div ui-view="graph"></div>
</div>
麪包。 js
'use strict';
angular.module('myApp')
.config(function ($stateProvider) {
$stateProvider
.state('bread', {
url: '/bread',
views: {
'@': {
templateUrl: 'app/breadcrumbs/views/home.tpl.html',
},
'[email protected]': {
templateUrl: 'app/breadcrumbs/views/home1.tpl.html',
},
},
controller: 'BreadCtrl'
});
});
作爲模板加載的html文件非常簡單。只包含段落標籤。
我試過使用嵌套視圖,但在ui-view =「filters」我無法加載模板。
謝謝,這個作品! – swateek
@swateek很高興爲您提供幫助......謝謝:) –
還有一個問題,是因爲我沒有加載所有的ui-views,我的頁面變得空白了嗎? – swateek