Home > database >  i'm trying to add a dropdown menu to the navigation bar using bootstrap 5.1.3
i'm trying to add a dropdown menu to the navigation bar using bootstrap 5.1.3

Time:06-27

i'm running into issues trying to implement a dropdown menu using bootstrap, all the links show the same result which isn't working for me, i have the following code and as mentioned i'm using bootstrap 5.1.3

<div >
   <button type="button"  id="navbarDropdown" data-bs-toggle="dropdown" aria-expanded="false">
                  Dropdown button
   </button>

   <ul  aria-labelledby="navbarDropdown">
      <li><a href="dropdown-item" (click)="logOut()">log out</a></li>
   </ul>
</div>

the result shows the "Dropdown button" without the log out button, however it doesn't open up the drop down menu as i click on it

CodePudding user response:

Did you try to add the js in angular.json , I think this problem comme from the js

Angular.json:

"styles": [
              "node_modules/@fortawesome/fontawesome-free/css/all.min.css",
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/assets/params/css/fonts.googleapis.min.css",
              "src/styles.css"
            ],
            "scripts": [
              "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
            ]
  • Related