[英]How to navigate one app component to another app component in angular4?
我的要求是:-如果有两个应用程序。 app1和app2。 app1的一些组件,以及类似的app2。 因此,如何在单击app1组件时重定向到单击app2组件。
请告诉我。
假设您的路由模块是..
imports goes here ....;
const routes: Routes = [
{
path: "",
component: HomePageComponent,
},
{
path: "newPage",
component: NewPageComponent,
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {}
而且,让你的默认网址为localhost:4200,然后,在网址为localhost:4200 / NEWPAGE你会看到新的部件装即NewPageComponent
中提到的Routes
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.