Angular

How To Install/Add Bootstrap In Angular App

This blog will give you an example of add bootstrap in angular. it’s a simple example of angular install bootstrap 4. Here you will learn to install bootstrap in angular. Alright, let’s dive into the steps.

As we know Bootstrap is the world’s most popular framework for building responsive, and mobile-first sites. bootstrap provides several classes for making responsive websites for your mobile.

I have a two-way install bootstrap and use it with your angular projects. I will give you both way example below:

Example 1:

In this example, you need to just install bootstrap on your angular and import the CSS file to the style.css file. this is only for CSS importing. so you can run the command below:

$ npm install bootstrap --save

Ok, now you need to import your bootstrap CSS on the style.css file as like below:

src/style.css

@import "~bootstrap/dist/css/bootstrap.css";

Now you can use the bootstrap class in your angular app. It will work fine.

Example 2:

In this example, we will also install bootstrap with jquery and popper js. so that way you can also import bootstrap CSS and bootstrap js function. So I think this will be the best solution for you I think.

Let’s run the following commands:

     1. Bootstrap

$ npm install bootstrap --save

     2. jQuery

$ npm install jquery --save

     3. popper.js

$ npm install popper.js --save

After successfully run the above command. let’s import it in angular.json file.

angular.json

 

....
      "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"
      ]
.....

Now you can use bootstrap CSS and js both. You can check your angular project.

I hope you guys understand how I can do this.  Let me know if you face any difficulties.

You can watch my previous blog here.

Happy Coding {;} 

Nayan Raval

Nayan Raval is a MEAN Stack .Net Developer has extensive experience with designing and developing enterprise-scale applications. Key Areas Of Expertise: • ASP.NET Core MVC • ASP.NET Core Web API • C# • ASP.NET MVC 5 • Angular All versions • HTML5 • CSS3 / SCSS • Bootstrap • JavaScript • Azure • JQuery Databases and related • Microsoft SQL server MSSQL • PostgreSQL • Entity Framework (EF) • LINQ UI Frameworks • Kendo UI • Telerik • JQuery UI • Prime NG and Material UI API Integration • SignalR • DateDog • Twilio Voice Call And Message • Stripe • SendGrid (Email Camping) • Checkr • Zoom Video Call • Auth0 • Elastic Search • Quartz - Scheduler • JWT Token • Google Calendar

Recent Posts

Testing hk

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Operation

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

TETS NEW

test

3 years ago