angularjs – Angular UI-Router多个视图
发布时间:2020-12-17 08:44:34 所属栏目:安全 来源:网络整理
导读:我使用angular UI-Router。我在我的路由配置中有以下 .config(function config($stateProvider) { $stateProvider.state('newsFeedView',{ url: '/newsFeed',controller: 'newsFeedController',templateUrl: '../src/app/bulletinBoard/views/newsFeed.part.
我使用angular UI-Router。我在我的路由配置中有以下
.config(function config($stateProvider) { $stateProvider.state('newsFeedView',{ url: '/newsFeed',controller: 'newsFeedController',templateUrl: '../src/app/bulletinBoard/views/newsFeed.part.html',data: { pageTitle: 'News Feed' } }) .state('tradeFeedView',{ url: '/tradeFeed',controller: 'tradeFeedController',templateUrl: '../src/app/bulletinBoard/views/tradeFeed.part.html',data: { pageTitle: 'Trade Feed' } }) .state('bulletinBoard',{ url: '/bulletinBoard',views: { 'tradeFeed': { url: "",templateUrl: '../src/app/bulletinBoard/views/tradeFeed.part.html' },'newsFeed': { url: "",templateUrl: '../src/app/bulletinBoard/views/newsFeed.part.html' } },templateUrl: '../src/app/bulletinBoard/views/bulletinBoard.part.html' }); }) 在我的索引页面,我只是调用视图使用: <div class="container" ui-view></div> 在我的公告BOo.html我想有一个嵌套视图: <div ui-view="tradeFeed"></div> <div ui-view="newsFeed"></div> 对于/ newsFeed页面和/ tradeFeed页面,这是完美的,但对于公告板,我看不到任何东西在页面上。我在哪里错了?
我发现在官方的GitHub wiki的例子是非常不直观。这里是一个更好的一个:
https://scotch.io/tutorials/angular-routing-using-ui-router 例如: ... .state('bulletinBoard',{ url: '/bulletinBoard',views: { // the main template will be placed here (relatively named) '': { templateUrl: '../src/app/bulletinBoard/views/bulletinBoard.part.html' },// the child views will be defined here (absolutely named) 'tradeFeed@bulletinBoard': { template: ..... },// another child view 'newsFeed@bulletinBoard': { templateUrl: ...... } } }); 每个视图属性的语法为viewName @ stateName。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 停止bash选项卡完成,以为我想要进入.svn目录
- 使用docker-compose指定sysctl值
- Scala隐式转换范围问题
- AngularJS(3)——使用$resourse定义Restful服务
- angular2 – 在NgModule中的声明,提供者和import之间有什么
- twitter-bootstrap – Bootstrap 4 – 如何使用媒体查询mix
- Bootstrap实现标签页效果
- scala – 错误:无效或损坏jarfile sbt / sbt-launch-0.13.
- bash – 有人应该如何为/ etc / shadow创建加密密码?
- Cannot bootstrap eureka server