const routes: Routes = [
{ path: "", component: HomeComponent },
{ path: "path1", component: OtherComponent },
{ path: "path2",
children: [
{ path: ":data", component: AnotherComponent }
]
}
]
<Button text="Pass data" nsRouterLink="/path2/<your-data>"></Button>
constructor(private activatedRoute: ActivatedRoute) { }
ngOnInit(): void {
this.pageRoute.activatedRoute.subscribe(
activatedRoute => {
activatedRoute.paramMap.subscribe(
paramMap => {
this.data = paramMap.get('data');
},
err => console.log(err)
);
}
);
}
);
}