• TechQA.

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

    149 views Asked by Diego At 2021-04-29T20:46:53+00:00 29 April 2021 at 20:46 2025-12-22T21:23:12+00:00

    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 answers

    0
    Xavier Brassoud Xavier Brassoud On 2021-04-29T20:56:36+00:00 29 April 2021 at 20:56

    Use routerLink instead of href.

    See Angular RouterLink.

    Related Questions in ANGULARJS

    • How to automatically change path in angular when scrolling
    • Error two clicks to be able to login Angular 16
    • Passing an array of objects through the $http.post method in angular JS does not work
    • Understanding how to apply Angular Signals from beginning on an existing service
    • provider duplicate while compiling a Cordova application for the Android platform
    • How can I use angularjs $parse service in Angular?
    • Width of custom headers in ag-grid (angular) doesn't match with column's width
    • Issues with Katex/ngx-markdown Rendering in Angular 16
    • How to make Angular SSR wait for async operations to finish that are initiated in ngOnInit?
    • I want to install @angular/google-maps npm Package in angular 16.2.12 but "npm install @angular/google-maps" this is not working/ tell me other query
    • Angular 17 standalone application integrate CKEditor 5 -- Error: window is not defined
    • Why is $scope >= 0 showing true in interpolation while empty in controller?
    • The XMLHttpRequest compatibility library was not found
    • Making Gantt Chart Column Labels More Readable
    • Pass key-value pairs of object as individual arguments to component in Angular

    Related Questions in BOOTSTRAP-4

    • Displaying a Movie List on a Website Using Jinja2 and Bootstrap
    • I just cant make it work, HTML, JS and Firebase error
    • enable overflown data visible outside the container
    • Html + Css good response on computer (even in minimized mode) but bad on mobile
    • n is not a constructor error for bs4.5.2 dropdown and jquery 3.5.1
    • How to write HTML CSS code for a header navbar that too responsive
    • Change Opacity of Bootstrap Button
    • PhotoSwipe image position affected by other img elements in html on mobile
    • Should i learn Bootstrap in 2024
    • Having trouble sizing single resizable column with Bootstrap
    • In Boostrap 4 how can I change the the translucency of toasts to fully opaque?
    • Project was bootstrapped with an old unsupported version of tools while creating react app
    • Tooltip positioned too high with data-bs-placement="top" in Bootstrap 5
    • TypeError when using Popper with Bootstrap 4
    • How can I generate a Business Model Canvas with Bootstrap Cards and integrate it as html in a qmd-file?

    Related Questions in ROUTERLINK

    • How can I solve this error usging routerLink in angular 17.2
    • Angular routerLink / (click) event does not work properly
    • What am I missing on a Basic Angular 17 to get Routing for an SPA to work?
    • Do web crawlers use crawl Angular's routerLink links without page reload?
    • How do I pass state to IonRouterLink in Ionic 7?
    • hash not being included in vue router-link: active-class
    • Angular RouterLink Issue
    • Nuxt 3 SSR , dynamic pages with nuxt-link
    • components are not loaded using vue's routerlink
    • Angular & Jest Testing - Can't get image src from an anchor using [routerLink]?
    • Angular button routerLink syntax explanation
    • How to fit router-link exacly to image? Vue js 3
    • Use either routerLink or href based on value whether it is internal or external
    • Active router link Angular
    • Angular routerlink is not working for some reason

    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?

    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)
    • Privacy
    • Terms
    • Cookies
    • Homegardensmart
    • Math
    • Aftereffectstemplates