How to make multilevel Drop-down menu in Navbar using Bootstrap 4 and Angular 7

Viewed 7074

I want to create multilevel dropdwon using bootstrap 4 and angular 7.

I could create simple dropdown in navbar using the official documentation of bootstrap.

But when i tried to create multilevel dropdown, it wont working.

Bootstrap 4: Multilevel Dropdown Inside Navigation

using the above link , I could find a solution to make multilevel dropdown.

But it uses some kind of jQuery code for working fine.

Is there any built in method for making multilevel dropdown using bootstrap?

I didn't see anything related to this in official documentation of bootstrap .

I don't know whether I missed any scripts or css in my code.

"styles": [
                            "node_modules/bootstrap/dist/css/bootstrap.min.css",
                            "src/styles.css"

                        ],
                        "scripts": [
                            "node_modules/jquery/dist/jquery.min.js",
                            "node_modules/bootstrap/dist/js/bootstrap.min.js",
                            "node_modules/popper.js/dist/popper.min.js"
                        ],


here is my angular.json part for bootstrap css and js.

any kind of Solution will be thankful.

enter image description here

I need the result something like this

1 Answers

Try with this:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>

<div class="container">
    <div class="row">
        <h2>Multi level dropdown menu in Bootstrap 3</h2>
        <hr>
        <div class="dropdown">
            <a id="dLabel" role="button" data-toggle="dropdown" class="btn btn-primary" data-target="#" href="/page.html">
                Dropdown <span class="caret"></span>
            </a>
            <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
              <li><a href="#">Some action</a></li>
              <li><a href="#">Some other action</a></li>
              <li class="divider"></li>
              <li class="dropdown-submenu">
                <a tabindex="-1" href="#">Hover me for more options</a>
                <ul class="dropdown-menu">
                  <li><a tabindex="-1" href="#">Second level</a></li>
                  <li class="dropdown-submenu">
                    <a href="#">Even More..</a>
                    <ul class="dropdown-menu">
                        <li><a href="#">3rd level</a></li>
                        <li><a href="#">3rd level</a></li>
                    </ul>
                  </li>
                  <li><a href="#">Second level</a></li>
                  <li><a href="#">Second level</a></li>
                </ul>
              </li>
            </ul>
        </div>
    </div>
</div>

See Reference: https://bootsnipp.com/snippets/kM4Q

Related