0

I am trying to migrate from angular js to angular 6.In angular js i have code

  <a data-target="#Test" data-toggle="tab">Test</a></li>
  <div class="tab-pane active" id="Test">

There are 4 such tabs and in angular 6 i have the code:

    <li class="active"><a href="#Test" [ngClass]="{ 'active':activeTab==='Test'}" (click)="Test('Test')" data-toggle="tab">Test</a></li>
    <div class="tab-pane active" id="Test" [ngClass]="{ 'active':activeTab==='Test'}">
    //component.ts
    activeTab = 'Test';


    Test(activeTab){
    this.activeTab = activeTab;
    }

I am referring to Change active bootstrap tab inside angular component but I am getting error Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'Test' Error: Cannot match any routes. URL Segment: 'Test'.

I dont understand what is going wrong, routes should not be needed for tabs. Thanks in advance

  • You are getting this error because of – Samarth Saxena Mar 04 '19 at 11:12
  • Possible duplicate of [Angular2 How to navigate to certain section of the page identified with an id attribute](https://stackoverflow.com/questions/40498333/angular2-how-to-navigate-to-certain-section-of-the-page-identified-with-an-id-at) – Samarth Saxena Mar 04 '19 at 11:13
  • I have to use tabs and when i click on routerLink="policies" i get the same error. @SamarthSaxena – user10003750 Mar 04 '19 at 11:42

0 Answers0