Kra*_*itz 5 angular-routing ionic-framework angular ionic4
我目前正在尝试将旧版 ionic 应用程序更新到 v4,但似乎无法找到与此导航等效的 v4
return this.app.getRootNav().setPages([
{page: Profile},
{page: SettingsPage, params: {id: userId}}
])
Run Code Online (Sandbox Code Playgroud)
小智 0
如果我正确理解你的问题,你需要创建一个路由数组并将其传递给路由器模块。我通常创建一个单独的路由模块,如下所示:
const routes: Routes = [
{
path:'',
redirectTo: 'home',
pathMatch: 'full',
},
{
path'home',
component: HomePage
}
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
Run Code Online (Sandbox Code Playgroud)
我相信对于 ionic 4,您可以使用主角度站点上列出的完全相同的路由技术: https: //angular.io/tutorial/toh-pt5