POV
POV

Reputation: 12015

How to change url by click tabs Angular2?

I use Material Tabs in Angular 2.

How can I change the URL address when clicking on a tab. It is required for history navigation.

Upvotes: 0

Views: 2873

Answers (1)

Kim Kern
Kim Kern

Reputation: 60357

When you use <md-tab-group>, then tab changes are within the same route (=url). If you want the route(=url) to be changed when you click on a different tab, you should use <nav md-tab-nav-bar> in combination with <router-outlet></router-outlet>. This is agnostic to your app's router implementation. (So it works with the standard Angular router.) Read more about this in the official tabs documentation.

Upvotes: 2

Related Questions