Eduard Arevshatyan Eduard Arevshatyan - 20 days ago 7
TypeScript Question

Route on id url

I am building a table app on angular 2, and now i use a routing to navigate on my page.

I have some click event, and after clicking i am going to another page with another table, something like this (click button):

enter image description here

And after that i would to set a new adress for any "смотр.", something like this: localhost/sm1, localhost/sm2 ...

How it possible?

Answer

You have two options

1 - on the template

<div [routerLink]="['somepath',item.id]"> </div>

2 - on your component some click event handler

onItemClick(item){
    this.router.navigate(['somepath',item.id]);
}
Comments