• DEVHIDE
    • Home (current)
    • About
    • Contact
    • Cookie
    • Home (current)
    • About
    • Contact
    • Cookie
    • Disclaimer
    • Privacy
    • TOS
    Login Or Sign up

    How can I avoid using routerlink in bootstrap tabs in an Angular project?

    149 Views Asked by Diego At 29 April 2021 at 20:46 2025-12-22T21:23:12.776000

    I am trying to setup HTML bootstrap tabs, the most basic possible ones:

      <ul class="nav nav-tabs" id="myTab" role="tablist">
        <li class="nav-item">
          <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Contact</a>
        </li>
      </ul>
      <div class="tab-content" id="myTabContent">
        <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">...</div>
        <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div>
        <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">...</div>
      </div>
    

    But because of routerlink in angular, I get redirected to https://localhost:5001/#profile instead of the div I am trying to open. I don't want to turn off routerlink because it is the main form of navigation for my site. I just want this one navbar to not use it. I haven't been able to find any way around this... Hopeful for an html solution, but open to anything :)

    angularjs bootstrap-4 routerlink
    Original Q&A
    1

    There are 1 best solutions below

    0
    Xavier Brassoud Xavier Brassoud On 29 April 2021 at 20:56

    Use routerLink instead of href.

    See Angular RouterLink.

    Related Questions in ANGULARJS

    • Angular Show All When No Filter Is Supplied
    • Using pagination on a table in AngularJS
    • State with different subviews
    • Getting and passing MVC Model data to AngularJS controller
    • Implementing prerender.io middleware in sails.js
    • Token based authorization in nodejs/ExpressJs and Angular(Single Page Application)
    • AngularJS, Google App Engine and URLrewrite
    • send data from table to another page into forms
    • How to write tests for classes with inheritance
    • angularJS sending OPTIONS instead of POST
    • Receiving POST from external application in AngularJS
    • Metaprogramming AngularJS Filters
    • Reload List after Closing Modal
    • Why is my angularjs site not completely crawlable?
    • Why is separation of JavaScript and HTML a good practice?

    Related Questions in BOOTSTRAP-4

    • How to remove these margins between my Bootstrap 4 links?
    • Float nav items to the right in Bootstrap 4?
    • What does offset do in Bootstrap 4?
    • Webpack: Bootstrap-loader is not able to find installed bootstrap 4 module
    • Angular 2 - how to use scss with bootstrap 4 in testing using webpack
    • Angular, Bootstrap 4, angular-cli - where to place dependent scss and import it?
    • Bootstrap 4 -- branding + navbar items
    • bootstrap 4 feedback text doesnt render properly
    • Bootstrap 4: How to make top fixed navbar stay in container and not stretch?
    • 4 column responsive in Bootstrap
    • Bootstrap 4 Dropdown not working
    • Change Bootstrap 4 tooltip template without refresh
    • Multi-item carousel bootstrap 4
    • Vertical alignment in Bootstrap 4
    • Align navbar toggle button to the right

    Related Questions in ROUTERLINK

    • Difference between [routerLink] and routerLink
    • Angular 2 - How do I pass a parameter to a routerLink that is binded property?
    • Angular 4 router loading all the components
    • How to VueJS router-link active style
    • Angular Material 2 Tab Links unable to set default active tab
    • In angular 4how to use tel: in a *ngHref
    • Angular 2/4 - routerLinkActive not working properly
    • Angular: Find Full URL String of Sibling Component in Routerlink
    • Angular routerLink [ng-reflect-router-link] styling not reflected in HTML in prod mode
    • Routing link is not working in dynamic html angular 8
    • Angular 8 - child routerLink doesn't work
    • VueJS Router Active Link Style to all elements inside the router-link
    • Ionic: routerLink does not work anymore since implementing navigation using tabs
    • How can I convert routerLink to href?
    • Ionic Vue: Router Link isn’t working/doing anything

    Trending Questions

    • UIImageView Frame Doesn't Reflect Constraints
    • Is it possible to use adb commands to click on a view by finding its ID?
    • How to create a new web character symbol recognizable by html/javascript?
    • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
    • Heap Gives Page Fault
    • Connect ffmpeg to Visual Studio 2008
    • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
    • How to avoid default initialization of objects in std::vector?
    • second argument of the command line arguments in a format other than char** argv or char* argv[]
    • How to improve efficiency of algorithm which generates next lexicographic permutation?
    • Navigating to the another actvity app getting crash in android
    • How to read the particular message format in android and store in sqlite database?
    • Resetting inventory status after order is cancelled
    • Efficiently compute powers of X in SSE/AVX
    • Insert into an external database using ajax and php : POST 500 (Internal Server Error)

    Popular # Hahtags

    javascript python java c# php android html jquery c++ css ios sql mysql r reactjs

    Popular Questions

    • How do I undo the most recent local commits in Git?
    • How can I remove a specific item from an array in JavaScript?
    • How do I delete a Git branch locally and remotely?
    • Find all files containing a specific text (string) on Linux?
    • How do I revert a Git repository to a previous commit?
    • How do I create an HTML button that acts like a link?
    • How do I check out a remote Git branch?
    • How do I force "git pull" to overwrite local files?
    • How do I list all files of a directory?
    • How to check whether a string contains a substring in JavaScript?
    • How do I redirect to another webpage?
    • How can I iterate over rows in a Pandas DataFrame?
    • How do I convert a String to an int in Java?
    • Does Python have a string 'contains' substring method?
    • How do I check if a string contains a specific word?
    .

    Copyright © 2021 Jogjafile Inc.

    • Disclaimer
    • Privacy
    • TOS
    • Homegardensmart
    • Math
    • Aftereffectstemplates