Adding the Bootstrap CSS framework to an Angular application

Rodrigo Kamada
2 min readJun 28, 2021

--

Introduction

Angular is a development platform for building WEB, mobile and desktop applications using HTML, CSS and TypeScript (JavaScript). Currently, Angular is at version 15 and Google is the main maintainer of the project.

Bootstrap is an open source CSS framework with many components for building responsive WEB interfaces.

Prerequisites

Before you start, you need to install and configure the tools:

Getting started

Create the Angular application

1. Let’s create the application with the Angular base structure using the @angular/cli with the route file and the SCSS style format.

2. Install the bootstrap and bootstrap-icons libraries.

3. Configure the bootstrap and bootstrap-icons libraries. Change the angular.json file and add the bootstrap.scss, bootstrap-icons.css and bootstrap.bundle.min.js files as below.

4. Install the @ng-bootstrap/ng-bootstrap library.

5. Import the NgbModule module. Change the app.module.ts file and add the lines as below.

6. Remove the contents of the AppComponent class from the src/app/app.component.ts file. Import the NgbModal service and create the open method as below.

7. Remove the contents of the src/app/app.component.html file. Add some components as below.

8. Run the application with the command below.

9. Ready! Access the URL http://localhost:4200/ and check if the application is working. See the application working on GitHub Pages and Stackblitz.

The application repository is available at https://github.com/rodrigokamada/angular-bootstrap.

This tutorial was posted on my blog in portuguese.

--

--

Rodrigo Kamada
Rodrigo Kamada

Written by Rodrigo Kamada

👨‍💻 Software Developer | ✍️ Technical Content Creator | 🤝 Open Source Contributor | 🎙️ Speaker | 👨‍🏫 Mentor | 🙌 Ambassador | ☁️ AWS Community Builder

No responses yet