I am using Angular2 to create an application i which i need to navigate between tabs using a button present inside the tabs.
my html is as the following :
<md-tab-group>
<md-tab label="one">
<button md-raised-button>Navigate to Two</button>
<button md-raised-button>Navigate to Three</button>
</md-tab label>
<md-tab label="two">
</md-tab label>
<md-tab label="three">
</md-tab label>
</md-tab-group>
So,when i click the navigate to three it should take me to the tab name three
I am using the Angular2 material design for this example can anyone know to solve this problem.
Thanks in advance
This can be achieved using selectedIndex input variable using the below code
and your typescript code will be
Update 1: Based on comment.
You can use the selectedIndexChange method to fix that error as below
and your code will have
Updated in the plunk as well.
LIVE DEMO
you want to use the Angular Router.
try this:
in your html
inside your component class
don't forget to import the Router in your component
import { Router } from '@angular/router';
in your module
and of course create
TwoComponent
andThreeComponent
.Hope this helps!