服务的事件点击按钮



我在touting中设置了路径:

{路径:"home",conponent:homecompent;}

app.component.html:<按钮(点击(=";routerLink=/home";

这是一个错误

要在单击时转到主页吗?

谢谢

我解决了它应用程序组件

<button (click)="goToHome('home')"/>

应用程序组件.ts

constructor(private router:Router){}
GOToHome(_pageName:string):void{
this.router.navigate[`${_pageName}'];

应用程序路由

{path:'home',
component:homecomponent
},

最新更新