【发布时间】:2016-04-30 05:26:36
【问题描述】:
我想将一个小原型从带有 Angular 1.4.7 的 Ionic 1.1.1 迁移到带有 Angular 2.0.0-beta.1 的 Ionic 2。在我当前的原型中,我使用带有抽象状态和嵌套视图的 Angular ui-router。
这是mystate.html的视图:
...
<ion-content scroll="false" class="mainPage">
<div class="row">
<div class="col col-33">
<ion-nav-view name="left"></ion-nav-view>
</div>
<div class="col col-67">
<ion-nav-view name="right"></ion-nav-view>
</div>
</div>
</ion-content>
...
这里是定义的状态:
...
.state('mystate', {
abstract: true,
templateUrl: 'app/ordering/views/mystate.html',
url:'/ordering'
})
.state('mystate.home', {
cache: false,
url:'/home',
views: {
'left': {
templateUrl: 'app/mystate/views/leftviewHome.html'
},
'right': {
templateUrl: 'app/mystate/views/rightviewHome.html'
}
}
})
.state('mystate.leftA', {
url:'/leftA',
views: {
'left': {
templateUrl: 'app/mystate/views/leftViewA.html'
}
}
})
.state('mystate.rightA', {
url:'/rightA,
views: {
'right': {
templateUrl: 'app/mystate/views/rightViewA.html'
}
}
})
...
Angular ui-router 允许:
- 一次加载两个不同的模板(例如
mystate.home)。 - 相互独立地加载嵌套视图(例如
mystate.leftA和mystate.rightA)。
所以我不知道如何使用 Angular2 路由器来实现这一点。有人可以给我一个例子或提示如何继续。
【问题讨论】:
标签: ionic-framework angular-ui-router angular router ionic2