RouterLink inside a navbar in a dropdown menu doesn't work (Angular and Springboot)How to pass a parameter to routerLink that is somewhere inside the URL?Angular 2 routerLink doesn't workAngular 2 unit testing components with routerLinkrouterLink only working from navbarAngular 2 routerLink not working inside ng2-bootstrap dropdown inside navbarAnchor tag in navbar takes whole row - angularrouterLink is not working in AngularAngular - routerLink inside routerLinkDropdown button inside navbar not working on angular cliAngular Routerlink doesn't work

What is this green alien supposed to be on the American covers?

Is it rude to refer to janitors as 'floor people'?

Use chown -R while excluding one or two files

Is there an English equivalent for "Les carottes sont cuites", while keeping the vegetable reference?

Is it legal for a supermarket to refuse to sell an adult beer if an adult with them doesn’t have their ID?

Optimising the Selection of MaxValue in Association

Does this sentence I constructed with my junior high school latin work? I write online advertising and want to come off as snobby as possible

How should one refer to knights (& dames) in academic writing?

Is it ethical for a company to ask its employees to move furniture on a weekend?

Why does Eliyahu appear at a brit milah?

Is there a typesafe way to get a Database.QueryLocator?

ArcPy Delete Function not working inside for loop?

what relax command means?

How to check if a new username is a system user?

How to find location on Cambridge-Mildenhall railway that still has tracks/rails?

Why did Steve Rogers choose this character in Endgame?

What is the difference between a Hosaka, Ono-Sendai, and a "deck"?

How Can I Process Untrusted Data Sources Securely?

Cauchy reals and Dedekind reals satisfy "the same mathematical theorems"

How possible is a successful landing just with 1 wing?

Alphanumeric Line and Curve Counting

What is the meaning of [[:space:]] in bash?

What happens if a company buys back all of its shares?

Why does FFmpeg choose 10+20+20 ms instead of an even 16 ms for 60 fps GIF images?



RouterLink inside a navbar in a dropdown menu doesn't work (Angular and Springboot)


How to pass a parameter to routerLink that is somewhere inside the URL?Angular 2 routerLink doesn't workAngular 2 unit testing components with routerLinkrouterLink only working from navbarAngular 2 routerLink not working inside ng2-bootstrap dropdown inside navbarAnchor tag in navbar takes whole row - angularrouterLink is not working in AngularAngular - routerLink inside routerLinkDropdown button inside navbar not working on angular cliAngular Routerlink doesn't work






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















i must develop a web App using spring boot and angular. In this app there is a tab which contains various data (connect with mongoDB).i created a component for add new data in this tab. The problem is when i try to press a link in a dropdown menu inside the navbar doesn't redirect me in the correct page but show me whitelabel page



i tried to use routerLink and href, delete the dropdown and using a button in a navbar.
i added the navar first in my index.html, then i tried inside app.component.



my index.html






 /* When the user clicks on the button, 
toggle between hiding and showing the dropdown content */
function myFunction()
document.getElementById("myDropdown").classList.toggle("show");


// Close the dropdown if the user clicks outside of it
window.onclick = function(e)
if (!e.target.matches('.dropbtn'))
var myDropdown = document.getElementById("myDropdown");
if (myDropdown.classList.contains('show'))
myDropdown.classList.remove('show');



 <header>
<div id="riga-top"></div>
<nav id="navbar">
<div id="area-logo-universita">
<img src="assets/img/logo-unicam.jpg">
</div>
<div id="area-logo-servizio">
<img src="">
</div>
<ul>
<li class="active collapse">
<a href="/contatto">HOME</a>
</li>
<li class="dropdown collapse">
<button class="dropbtn" onclick="myFunction()">Aziende
<span class="caret"></span>
</button>
<div class="dropdown-menu dropdown-content" id="myDropdown">
<a href="/azienda" class="ainside">Aggiungi Azienda</a>
</div>
</li>

</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<div class="content-wrapper" style="background-color: rgb(236, 240, 245) !important; background-image: url(&quot;/Content/images/bg-home.jpg&quot;) !important; background-repeat: no-repeat !important; min-height: 710px;">
<div class="container">
<!-- Main content -->
<section class="content">
<app-root></app-root>
</section><!-- /.content -->
</div>
</div>
<footer>
</footer>













share|improve this question






























    0















    i must develop a web App using spring boot and angular. In this app there is a tab which contains various data (connect with mongoDB).i created a component for add new data in this tab. The problem is when i try to press a link in a dropdown menu inside the navbar doesn't redirect me in the correct page but show me whitelabel page



    i tried to use routerLink and href, delete the dropdown and using a button in a navbar.
    i added the navar first in my index.html, then i tried inside app.component.



    my index.html






     /* When the user clicks on the button, 
    toggle between hiding and showing the dropdown content */
    function myFunction()
    document.getElementById("myDropdown").classList.toggle("show");


    // Close the dropdown if the user clicks outside of it
    window.onclick = function(e)
    if (!e.target.matches('.dropbtn'))
    var myDropdown = document.getElementById("myDropdown");
    if (myDropdown.classList.contains('show'))
    myDropdown.classList.remove('show');



     <header>
    <div id="riga-top"></div>
    <nav id="navbar">
    <div id="area-logo-universita">
    <img src="assets/img/logo-unicam.jpg">
    </div>
    <div id="area-logo-servizio">
    <img src="">
    </div>
    <ul>
    <li class="active collapse">
    <a href="/contatto">HOME</a>
    </li>
    <li class="dropdown collapse">
    <button class="dropbtn" onclick="myFunction()">Aziende
    <span class="caret"></span>
    </button>
    <div class="dropdown-menu dropdown-content" id="myDropdown">
    <a href="/azienda" class="ainside">Aggiungi Azienda</a>
    </div>
    </li>

    </nav>
    </header>
    <!-- Left side column. contains the logo and sidebar -->
    <div class="content-wrapper" style="background-color: rgb(236, 240, 245) !important; background-image: url(&quot;/Content/images/bg-home.jpg&quot;) !important; background-repeat: no-repeat !important; min-height: 710px;">
    <div class="container">
    <!-- Main content -->
    <section class="content">
    <app-root></app-root>
    </section><!-- /.content -->
    </div>
    </div>
    <footer>
    </footer>













    share|improve this question


























      0












      0








      0








      i must develop a web App using spring boot and angular. In this app there is a tab which contains various data (connect with mongoDB).i created a component for add new data in this tab. The problem is when i try to press a link in a dropdown menu inside the navbar doesn't redirect me in the correct page but show me whitelabel page



      i tried to use routerLink and href, delete the dropdown and using a button in a navbar.
      i added the navar first in my index.html, then i tried inside app.component.



      my index.html






       /* When the user clicks on the button, 
      toggle between hiding and showing the dropdown content */
      function myFunction()
      document.getElementById("myDropdown").classList.toggle("show");


      // Close the dropdown if the user clicks outside of it
      window.onclick = function(e)
      if (!e.target.matches('.dropbtn'))
      var myDropdown = document.getElementById("myDropdown");
      if (myDropdown.classList.contains('show'))
      myDropdown.classList.remove('show');



       <header>
      <div id="riga-top"></div>
      <nav id="navbar">
      <div id="area-logo-universita">
      <img src="assets/img/logo-unicam.jpg">
      </div>
      <div id="area-logo-servizio">
      <img src="">
      </div>
      <ul>
      <li class="active collapse">
      <a href="/contatto">HOME</a>
      </li>
      <li class="dropdown collapse">
      <button class="dropbtn" onclick="myFunction()">Aziende
      <span class="caret"></span>
      </button>
      <div class="dropdown-menu dropdown-content" id="myDropdown">
      <a href="/azienda" class="ainside">Aggiungi Azienda</a>
      </div>
      </li>

      </nav>
      </header>
      <!-- Left side column. contains the logo and sidebar -->
      <div class="content-wrapper" style="background-color: rgb(236, 240, 245) !important; background-image: url(&quot;/Content/images/bg-home.jpg&quot;) !important; background-repeat: no-repeat !important; min-height: 710px;">
      <div class="container">
      <!-- Main content -->
      <section class="content">
      <app-root></app-root>
      </section><!-- /.content -->
      </div>
      </div>
      <footer>
      </footer>













      share|improve this question
















      i must develop a web App using spring boot and angular. In this app there is a tab which contains various data (connect with mongoDB).i created a component for add new data in this tab. The problem is when i try to press a link in a dropdown menu inside the navbar doesn't redirect me in the correct page but show me whitelabel page



      i tried to use routerLink and href, delete the dropdown and using a button in a navbar.
      i added the navar first in my index.html, then i tried inside app.component.



      my index.html






       /* When the user clicks on the button, 
      toggle between hiding and showing the dropdown content */
      function myFunction()
      document.getElementById("myDropdown").classList.toggle("show");


      // Close the dropdown if the user clicks outside of it
      window.onclick = function(e)
      if (!e.target.matches('.dropbtn'))
      var myDropdown = document.getElementById("myDropdown");
      if (myDropdown.classList.contains('show'))
      myDropdown.classList.remove('show');



       <header>
      <div id="riga-top"></div>
      <nav id="navbar">
      <div id="area-logo-universita">
      <img src="assets/img/logo-unicam.jpg">
      </div>
      <div id="area-logo-servizio">
      <img src="">
      </div>
      <ul>
      <li class="active collapse">
      <a href="/contatto">HOME</a>
      </li>
      <li class="dropdown collapse">
      <button class="dropbtn" onclick="myFunction()">Aziende
      <span class="caret"></span>
      </button>
      <div class="dropdown-menu dropdown-content" id="myDropdown">
      <a href="/azienda" class="ainside">Aggiungi Azienda</a>
      </div>
      </li>

      </nav>
      </header>
      <!-- Left side column. contains the logo and sidebar -->
      <div class="content-wrapper" style="background-color: rgb(236, 240, 245) !important; background-image: url(&quot;/Content/images/bg-home.jpg&quot;) !important; background-repeat: no-repeat !important; min-height: 710px;">
      <div class="container">
      <!-- Main content -->
      <section class="content">
      <app-root></app-root>
      </section><!-- /.content -->
      </div>
      </div>
      <footer>
      </footer>









       /* When the user clicks on the button, 
      toggle between hiding and showing the dropdown content */
      function myFunction()
      document.getElementById("myDropdown").classList.toggle("show");


      // Close the dropdown if the user clicks outside of it
      window.onclick = function(e)
      if (!e.target.matches('.dropbtn'))
      var myDropdown = document.getElementById("myDropdown");
      if (myDropdown.classList.contains('show'))
      myDropdown.classList.remove('show');



       <header>
      <div id="riga-top"></div>
      <nav id="navbar">
      <div id="area-logo-universita">
      <img src="assets/img/logo-unicam.jpg">
      </div>
      <div id="area-logo-servizio">
      <img src="">
      </div>
      <ul>
      <li class="active collapse">
      <a href="/contatto">HOME</a>
      </li>
      <li class="dropdown collapse">
      <button class="dropbtn" onclick="myFunction()">Aziende
      <span class="caret"></span>
      </button>
      <div class="dropdown-menu dropdown-content" id="myDropdown">
      <a href="/azienda" class="ainside">Aggiungi Azienda</a>
      </div>
      </li>

      </nav>
      </header>
      <!-- Left side column. contains the logo and sidebar -->
      <div class="content-wrapper" style="background-color: rgb(236, 240, 245) !important; background-image: url(&quot;/Content/images/bg-home.jpg&quot;) !important; background-repeat: no-repeat !important; min-height: 710px;">
      <div class="container">
      <!-- Main content -->
      <section class="content">
      <app-root></app-root>
      </section><!-- /.content -->
      </div>
      </div>
      <footer>
      </footer>






       /* When the user clicks on the button, 
      toggle between hiding and showing the dropdown content */
      function myFunction()
      document.getElementById("myDropdown").classList.toggle("show");


      // Close the dropdown if the user clicks outside of it
      window.onclick = function(e)
      if (!e.target.matches('.dropbtn'))
      var myDropdown = document.getElementById("myDropdown");
      if (myDropdown.classList.contains('show'))
      myDropdown.classList.remove('show');



       <header>
      <div id="riga-top"></div>
      <nav id="navbar">
      <div id="area-logo-universita">
      <img src="assets/img/logo-unicam.jpg">
      </div>
      <div id="area-logo-servizio">
      <img src="">
      </div>
      <ul>
      <li class="active collapse">
      <a href="/contatto">HOME</a>
      </li>
      <li class="dropdown collapse">
      <button class="dropbtn" onclick="myFunction()">Aziende
      <span class="caret"></span>
      </button>
      <div class="dropdown-menu dropdown-content" id="myDropdown">
      <a href="/azienda" class="ainside">Aggiungi Azienda</a>
      </div>
      </li>

      </nav>
      </header>
      <!-- Left side column. contains the logo and sidebar -->
      <div class="content-wrapper" style="background-color: rgb(236, 240, 245) !important; background-image: url(&quot;/Content/images/bg-home.jpg&quot;) !important; background-repeat: no-repeat !important; min-height: 710px;">
      <div class="container">
      <!-- Main content -->
      <section class="content">
      <app-root></app-root>
      </section><!-- /.content -->
      </div>
      </div>
      <footer>
      </footer>







      java angular typescript spring-boot






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 9:39









      Kalaiselvan

      1,7301 gold badge11 silver badges24 bronze badges




      1,7301 gold badge11 silver badges24 bronze badges










      asked Mar 26 at 9:13









      Maurizio VenanziniMaurizio Venanzini

      11 bronze badge




      11 bronze badge






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You have to implement Router Link like below and should not use href, you can find complete documentation here.



          Replace following



          <li class="active collapse">
          <a href="/contatto">HOME</a>
          </li>


          By this



          <li class="active collapse">
          <a [routerLink]="['/contatto']">
          HOME
          </a>
          </li>





          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353419%2frouterlink-inside-a-navbar-in-a-dropdown-menu-doesnt-work-angular-and-springbo%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You have to implement Router Link like below and should not use href, you can find complete documentation here.



            Replace following



            <li class="active collapse">
            <a href="/contatto">HOME</a>
            </li>


            By this



            <li class="active collapse">
            <a [routerLink]="['/contatto']">
            HOME
            </a>
            </li>





            share|improve this answer





























              1














              You have to implement Router Link like below and should not use href, you can find complete documentation here.



              Replace following



              <li class="active collapse">
              <a href="/contatto">HOME</a>
              </li>


              By this



              <li class="active collapse">
              <a [routerLink]="['/contatto']">
              HOME
              </a>
              </li>





              share|improve this answer



























                1












                1








                1







                You have to implement Router Link like below and should not use href, you can find complete documentation here.



                Replace following



                <li class="active collapse">
                <a href="/contatto">HOME</a>
                </li>


                By this



                <li class="active collapse">
                <a [routerLink]="['/contatto']">
                HOME
                </a>
                </li>





                share|improve this answer















                You have to implement Router Link like below and should not use href, you can find complete documentation here.



                Replace following



                <li class="active collapse">
                <a href="/contatto">HOME</a>
                </li>


                By this



                <li class="active collapse">
                <a [routerLink]="['/contatto']">
                HOME
                </a>
                </li>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 26 at 10:58

























                answered Mar 26 at 10:15









                Aniket KamtheAniket Kamthe

                312 bronze badges




                312 bronze badges


















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353419%2frouterlink-inside-a-navbar-in-a-dropdown-menu-doesnt-work-angular-and-springbo%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript