Hel*_*rld 6 angularjs angular-ui-router material-design
应用程序启动时TabControl可见但是......
当我点击标签时,没有内容可见
我错了什么?
我使用最新的angularJS材料设计0.9.4.
$urlRouterProvider.otherwise("");
$stateProvider
.state("main",
{
abtract: true,
url: '',
views: {
'content@': {
templateUrl: '../app/views/administration/administration.html',
controller: 'AdministrationController'
}
}
})
.state('main.settings', {
url: '/settings',
views: {
'settings@main': {
templateUrl: "../app/views/administration/settings.html",
controller: 'GlobalConfigurationController'
}
}
})
.state('main.schoolyears', {
url: '/schoolyears',
views: {
'schoolyears@main': {
templateUrl: "../app/views/schoolyear/schoolyears.html",
controller: 'SchoolyearsController'
}
}
});
Run Code Online (Sandbox Code Playgroud)
HTML
<div layout-fill layout="column">
<div ng-include="'app/components/navbar/navbar.html'"></div>
<div id="content" layout="column" layout-padding>
<md-tabs md-stretch-tabs="always" class="md-primary md-hue-2">
<md-tab label="Schoolyears" ui-sref="main.schoolyears" md-active="$state.is('main.schoolyears')">
<md-tab-body ui-view="schoolyears" layout="vertical" layout-fill></md-tab-body>
</md-tab>
<md-tab label="settings" ui-sref="main.settings" md-active="$state.is('main.settings')">
<md-tab-body ui-view="settings" layout="vertical" layout-fill></md-tab-body>
</md-tab>
</md-tabs>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
更新:使用
ui-sref和md-tabs固定在Angular Material 0.10.0中
在上一个已知的md-tab问题上,已经在github上发布了一个解决方法:
有一个解决方案的plunker(似乎没有视图工作):
$stateProvider
.state('tabs', {
abstract: true,
url: '/tabs',
templateUrl: 'tabs.html',
onEnter: function() { console.log("enter tabs.html"); } })
.state('tabs.tab1', {
url: '/tab1',
onEnter: function() { console.log("enter tab1.html"); },
controller: function($scope) {
},
templateUrl: 'tab1.html'
})
.state('tabs.tab2', {
url: '/tab2',
onEnter: function() { console.log("enter tab2"); },
controller: function($scope) {
},
templateUrl: 'tab2.html'
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9391 次 |
| 最近记录: |