Categories

Sunday, November 24, 2024
#919814419350 therichposts@gmail.com
Angular 13Bootstrap 5

Angular 13 Bootstrap 5 Responsive Megamenu Working Example

Angular 13 Bootstrap 5 Responsive Megamenu Working Example

Hello friends, welcome back to my blog. Today in this blog post, I am going to tell you, Angular 13 Bootstrap 5 Responsive Megamenu Working Example.

Here is the tutorial link for update angular version to 13: Update Angular 13 to Angular 13

Add Bootstrap 5 in Angular 13

Guy’s here are the more demos related to Angular 12 with Bootstrap 5:

  1. Bootstrap 5 Popover working in Angular 12
  2. Bootstrap 5 Tooltip working in Angular 12
  3. Bootstrap5 Modal with Forms in Angular 12


Angular 13 Bootstrap 5 Responsive Megamenu Working Example
Angular 13 Bootstrap 5 Responsive Megamenu Working Example

Angular 13 came and Bootstrap 5 also and if you are new then you must check below two links:

  1. Angular13 Tutorials
  2. Angular12 Free Templates
  3. Bootstrap 5

Friends now I proceed onwards and here is the working code snippet and please use carefully this to avoid the mistakes:

1. Firstly friends we need fresh angular 13 setup and for this we need to run below commands but if you already have angular 13 setup then you can avoid below commands. Secondly we should also have latest node version installed on our system:

npm install -g @angular/cli 

ng new angularboot5 //Create new Angular Project

cd angularboot5 // Go inside the Angular Project Folder

2. Now friends, here we need to run below commands into our project terminal to install bootstrap 5 modules into our angular application:

npm install bootstrap

npm i @popperjs/core

3. Now friends we just need to add below code into src/app/app.component.html file to get final out on the web browser:

<div class="APP">
  <!--Mega Menu-->
  <nav class="navbar navbar-expand-lg navbar-light bg-white py-3 shadow-sm">
    <div class="container-fluid">
    <a href="#" class="navbar-brand font-weight-bold d-block d-lg-none">MegaMenu</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div id="navbarSupportedContent" class="collapse navbar-collapse">
      <ul class="navbar-nav mx-auto">
        <!-- Megamenu-->
        <li class="nav-item dropdown megamenu"><a id="megamneu" href="#" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false" class="nav-link dropdown-toggle font-weight-bold text-uppercase dropdown-toggle">Mega Menu</a>
          <div aria-labelledby="dropdownMenuButton1" class="dropdown-menu border-0 p-0 m-0">
            <div class="container">
              <div class="row bg-white rounded-0 m-0 shadow-sm">
                <div class="col-lg-7 col-xl-8">
                  <div class="p-4">
                    <div class="row">
                      <div class="col-lg-6 mb-4">
                        <h6 class="font-weight-bold text-uppercase">MegaMenu heading</h6>
                        <ul class="list-unstyled">
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0">Unique Features</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Image Responsive</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Auto Carousel</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Newsletter Form</a></li>
                        </ul>
                      </div>
                      <div class="col-lg-6 mb-4">
                        <h6 class="font-weight-bold text-uppercase">MegaMenu heading</h6>
                        <ul class="list-unstyled">
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Unique Features</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Image Responsive</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Auto Carousel</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Newsletter Form</a></li>
                        </ul>
                      </div>
                      <div class="col-lg-6 mb-4">
                        <h6 class="font-weight-bold text-uppercase">MegaMenu heading</h6>
                        <ul class="list-unstyled">
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Unique Features</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Image Responsive</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Auto Carousel</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Newsletter Form</a></li>
                        </ul>
                      </div>
                      <div class="col-lg-6 mb-4">
                        <h6 class="font-weight-bold text-uppercase">MegaMenu heading</h6>
                        <ul class="list-unstyled">
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Unique Features</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Image Responsive</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Auto Carousel</a></li>
                          <li class="nav-item"><a href="" class="nav-link text-small pb-0 ">Newsletter Form</a></li>
                        </ul>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-lg-5 col-xl-4 px-0 d-none d-lg-block" style="background: center center url(https://therichpost.com/wp-content/uploads/2021/11/mega.png)no-repeat; background-size: cover;"></div>
</div> </div> </div> </li> <li class="nav-item"><a href="" class="nav-link font-weight-bold text-uppercase">About</a></li> <li class="nav-item"><a href="" class="nav-link font-weight-bold text-uppercase">Services</a></li> <li class="nav-item"><a href="" class="nav-link font-weight-bold text-uppercase">Contact</a></li> </ul> </div> </div> </nav> <!-- For demo purpose --> <section class="py-5 text-white"> <div class="container py-4"> <div class="row"> <div class="col-lg-8 mx-auto text-center"> <h1 class="display-4">Angular 13 Bootstrap 5 megamenu</h1> <p class="lead mb-0">A very simple way to create Angular 13 Bootstrap 5 megamneu. </p> <p class="lead">Snippet by <a href="https://therichpost.com/" class='text-white'><u>Therichpost</u></a>. </p> </div> </div> <div class="row pt-5"> <div class="col-lg-10 mx-auto"> <p class="lead">Use the default Bootstrap's dropdown menu to hold your megamneu.</p> <p class="lead">Set the <code>.dropdown</code> position to <code>static</code> instead of <code>absolute</code>.</p> <p class="lead">We use the class <code>.megamenu</code> to hold this <code>static</code> position.</p> </div> </div> </div> </section> <!-- End --> <!--Menu Menu--> </div>

4. Now friends we just need to add below code into angular.json file:

"styles": [
              ...
              "node_modules/bootstrap/dist/css/bootstrap.min.css"
          ],
"scripts": [
              ...
               "node_modules/bootstrap/dist/js/bootstrap.min.js"
           ]

5. Now friends we just need to add below code into src/app/app.component.css file:

/*
*
* ==========================================
* CUSTOM UTIL CLASSES
* ==========================================
*
*/

.megamenu {
    position: static;
  }
  
  .megamenu .dropdown-menu {
    background: none;
    border: none;
    width: 100%;
  }
  
  /*
  *
  * ==========================================
  * FOR DEMO PURPOSES
  * ==========================================
  *
  */
  
  .APP  {
    background: #eaafc8;
    background: -webkit-linear-gradient(to right, #eaafc8, #654ea3);
    background: linear-gradient(to right, #eaafc8, #654ea3);
    min-height: 100vh;
  }
  
  code {
    color: #745eb1;
    background: #fff;
    padding: 0.1rem 0.2rem;
    border-radius: 0.2rem;
  }
  
  .text-uppercase {
    letter-spacing: 0.08em;
  }

Friends in the end must run ng serve command into your terminal to run the angular 13 project.

Now we are done friends. If you have any kind of query, suggestion and new requirement then feel free to comment below.

Note: Friends, In this post, I just tell the basic setup and things, you can change the code according to your requirements.

I will appreciate that if you will tell your views for this post. Nothing matters if your views will be good or bad because with your views, I will make my next posts more good and helpful.

Jassa

Thanks

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.