我有初始化app.js脚本,其中概述了我的应用程序的可能状态
问题是当我打开公司状态然后打开新闻或事件状态时,它不会替换来自另一个州的视图,而只是将它组合起来。
{
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"id": "10218",
"self": "http://localhost:8080/rest/api/2/issue/10218",
"key": "KEY-123",
"fields": {
"description": "The issue description"
}
}
我可以看到来自公司和事件的两个''视图状态,而我在主html页面中只有一个视图调用
app.config(function($stateProvider, $urlRouterProvider, $locationProvider, $compileProvider) {
$stateProvider
.state('main', {
url: '/',
views: {
'search': {
templateUrl: 'views/search.html',
controller: 'categoryCtrl'
},
'footer': {
templateUrl: 'views/footer.html'
}
}
})
.state('company', {
url: '/company/:id',
views: {
'': {
templateUrl: 'views/company.html',
controller: 'companyCtrl'
},
'about@company': {
templateUrl: 'views/company-tabs/about.html'
},
'testimonials@company': {
templateUrl: 'views/company-tabs/testimonials.html'
},
'questions@company': {
templateUrl: 'views/company-tabs/questions.html'
},
'contacts@company': {
templateUrl: 'views/company-tabs/contacts.html',
controller: 'yaMapCtrl'
},
'form@company': {
templateUrl: 'views/form.html',
controller: 'formCtrl'
}
}
})
.state('news', {
url: '/news',
views: {
'': {
templateUrl: 'views/news.html',
controller: 'newsCtrl'
}
}
})
.state('events', {
url: '/events',
views: {
'': {
templateUrl: 'views/events.html',
controller: 'eventsCtrl'
}
}
});
})
请帮忙