我知道这是一个很好的问题,但可能是我的“谷歌搜索”技能不足以让我得到我想要的东西。
所以我有一个页面,ng-view
主要是index.html
<div class="row" style="margin-top: 70px;" ui-view></div>
现在我有一个模板 url 为student.html的视图
<div class="col-md-10 col-md-offset-1" ng-controller="Controller_Parent">
<div ng-cloak>
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="View Profile" ui-view="student.profile">
</md-tab>
<md-tab label="View Results" ui-view="student.result">
</md-tab>
<md-tab label="View Attendance" ui-view="student.attendance">
</md-tab>
</md-tabs>
</div>
</div>
正如代码所示,在Controller_A
我想要三个视图(正确的子视图)中,每个视图都有自己的模板。
路由代码是这样的:
app.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home', {
url: '/',
templateUrl: 'templates/login.html',
}).state('student',{
url:'/student',
views:{
'@':{
templateUrl: 'templates/student.html',
},
'profile@student':{
templateUrl:'templates/student/profile.html'
},
}
});
});
我应该做些什么来使这个想法奏效。我已经阅读了这些教程,不幸的是它们都没有类似的工作,或者我可能正在寻找错误的空间。
等待您的输入。问候!
PS:不抛出 JS 错误