1

I am trying to make a bootstrap tab. The problem is when I click the tab links angular is doing it's own routing and taking me to different route. I want the tab content to be opened not jump to different route.

<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active">
        <a href="#basic" aria-controls="basic" target="_self" role="tab" data- 
        toggle="tab">Vehicle</a>
    </li>
    <li role="presentation">
        <a href="#photos" aria-controls="photos" role="tab" target="_self" data-toggle="tab">Photos</a>
    </li>
</ul>

When I click the Photos link angular changes the route and takes me to different component rather than showing me the Vehicle tab content.

1
  • You should not use href with angular. It will reload the entire page every time you click. To implement router Read the doc:angular.io/guide/router Commented Feb 6, 2019 at 7:04

1 Answer 1

2

replace href with data-target as below. Hopefully it will work.

<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active">
        <a data-target="#basic" aria-controls="basic" target="_self" role="tab" data-toggle="tab">Vehicle</a>
    </li>
    <li role="presentation">
        <a data-target="#photos" aria-controls="photos" role="tab" target="_self" data-toggle="tab">Photos</a>
    </li>
</ul>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.