我正在创建一个网络应用程序来帮助学生学习科学、历史和数学。当您第一次登陆该网站时,我有一个主页/登陆页面。当您单击“开始”时,我会转到/exam/instructions。我的每个步骤都说明了我加载到的模板中的数学和科学ui-view="exam-detail"
。目前全ui-view
当我通过科学导航来回浏览指令时加载。理想情况下,我只想要一个分页区域和一个主题区域,并且只想要ui-view="exam-detail"
使用正确的模板进行更新。
我根本没有使用过 UI-Router,任何帮助将不胜感激。
索引.html
<div ui-view></div>
状态考试>exam.html
<div class="state-exam">
<nav ui-view="exam-pagination"></nav>
<section ui-view="exam-detail"></section>
</div>
route.js
(function() {
'use strict';
angular
.module('studentPortal')
.config(routeConfig);
function routeConfig($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
url: '/',
templateUrl: 'app/main/main.html',
controller: 'MainController',
controllerAs: 'main'
})
.state('exam', {
url: '/exam/:step',
abstract: true,
templateUrl: 'app/state-exam/exam.html',
controller: 'ExamController',
controllerAs: 'examController',
})
.state('exam.instructions', {
url: '/instructions',
views: {
'exam-pagination':{
templateUrl: 'app/state-exam/exam-pagination.html'
},
'exam-detail' : {
templateUrl: 'app/state-exam/exam-instructions.html'
}
}
})
.state('exam.math', {
url: '/math',
views: {
'exam-pagination':{
templateUrl: 'app/state-exam/exam-pagination.html'
},
'exam-detail' : {
templateUrl: 'app/state-exam/exam-math.html'
}
}
});
$urlRouterProvider.otherwise('/');
}
})();