我想弄清楚为什么我第一次来“审计”状态时“audit.content”执行;但随后从“审计”调用“审计”状态更新了我的“audit.content”视图。
非常感谢任何帮助。
谢谢。
以下是我的dotJEM / Angular-Routing的详细信息:
我有一个索引文件,其中包含一个jemView:
<div jem-view="main.content"></div>
我有一个new-audit-view.html页面,里面有两个嵌套的jemView,如下所示:
<div class="row">
<div class="col-md-4">
<div jem-view="audit.actions">
</div>
</div>
<div class="col-md-8">
<div jem-view="audit.content">
</div>
</div>
</div>
这是我的application.js文件:
angular.module('OReillyAutoPricingWebApp',
[
'dotjem.routing'
])
// Configuration of the routes for linking to different view of the application.
.config(['$stateProvider', '$routeProvider', function ($stateProvider, $routeProvider) {
$routeProvider
.otherwise({redirectTo: '/audit-review-tab' });
$stateProvider
.state('home', { route: '/', views: { 'main.content': { template: 'views/review-audits.html'} } })
.state('audit', { route: '/audit/:auditItemListType', views: {
'main.content': {template: 'views/new-audit-view.html'},
'audit.actions': {template: 'partials/audit-action-items.html', controller: 'StoreAuditItemController'},
'audit.content': {template: ['$location', function ($location) {
var resourceLoader = new NoesisCode.ResourceLoader(),
partialUrl = ($location.search().url !== undefined)? $location.search().url: "",
templateHtml = ($location.search().url !== undefined)? resourceLoader.loadXMLDoc(partialUrl): "";
return templateHtml;
}], controller: 'StoreAuditItemController'}}
})
.state('audits', { route: '/audits', views: { 'main.content': { template: 'views/review-audits.html'} } })
}]);
答案 0 :(得分:0)
我需要将$ transitionProvider服务添加到配置中。然后像这样实现转换:
$stateTransitionProvider
.transition('*', 'audit', function ($view){
$view.clear('audit.content');
$view.update('audit.content', {template: ['$location', function ($location) {
var resourceLoader = new NoesisCode.ResourceLoader(),
partialUrl = ($location.search().url !== undefined)? $location.search().url: "",
templateHtml = ($location.search().url !== undefined)? resourceLoader.loadXMLDoc(partialUrl): "";
console.info("inside audit.content view");
return templateHtml;
}], controller: 'StoreAuditItemController'});
});