How To Add Bootstrap To An Angular Application
How To Add Bootstrap To An Angular Application
Forum Donate
Prerequisites
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 1/10
11/08/2024, 12:27 How to Add Bootstrap to an Angular Application
Let's create the application with the Angular base structure using
the @angular/cli with the route file and the SCSS style format.
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 2/10
11/08/2024, 12:27 How to Add Bootstrap to an Angular Application
ng new angular-bootstrap
Forum Donate
? Would you like to add Angular routing? Yes
Learn to code — free 3,000-hour curriculum
? Which stylesheet format would you like to use? SCSS [ https:/
CREATE angular-bootstrap/README.md (1062 bytes)
CREATE angular-bootstrap/.editorconfig (274 bytes)
CREATE angular-bootstrap/.gitignore (604 bytes)
CREATE angular-bootstrap/angular.json (3273 bytes)
CREATE angular-bootstrap/package.json (1079 bytes)
CREATE angular-bootstrap/tsconfig.json (783 bytes)
CREATE angular-bootstrap/.browserslistrc (703 bytes)
CREATE angular-bootstrap/karma.conf.js (1434 bytes)
CREATE angular-bootstrap/tsconfig.app.json (287 bytes)
CREATE angular-bootstrap/tsconfig.spec.json (333 bytes)
CREATE angular-bootstrap/src/favicon.ico (948 bytes)
CREATE angular-bootstrap/src/index.html (302 bytes)
CREATE angular-bootstrap/src/main.ts (372 bytes)
CREATE angular-bootstrap/src/polyfills.ts (2820 bytes)
CREATE angular-bootstrap/src/styles.scss (80 bytes)
CREATE angular-bootstrap/src/test.ts (743 bytes)
CREATE angular-bootstrap/src/assets/.gitkeep (0 bytes)
CREATE angular-bootstrap/src/environments/environment.prod.ts (51
CREATE angular-bootstrap/src/environments/environment.ts (658 byt
CREATE angular-bootstrap/src/app/app-routing.module.ts (245 bytes
CREATE angular-bootstrap/src/app/app.module.ts (393 bytes)
CREATE angular-bootstrap/src/app/app.component.scss (0 bytes)
CREATE angular-bootstrap/src/app/app.component.html (23809 bytes)
CREATE angular-bootstrap/src/app/app.component.spec.ts (1090 byte
CREATE angular-bootstrap/src/app/app.component.ts (222 bytes)
✔ Packages installed successfully.
Successfully initialized git.
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 3/10
11/08/2024, 12:27 How to Add Bootstrap to an Angular Application
"styles": [
"node_modules/bootstrap/scss/bootstrap.scss",
"node_modules/bootstrap-icons/font/bootstrap-icons.css",
"src/styles.scss"
],
"scripts": [
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
]
imports: [
BrowserModule,
NgbModule,
AppRoutingModule,
],
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 4/10
11/08/2024, 12:27 How to Add Bootstrap to an Angular Application
Forum Donate
import { Component } from '@angular/core';
import { NgbModal
Learn to} code
from—'@ng-bootstrap/ng-bootstrap';
free 3,000-hour curriculum
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 6/10
11/08/2024, 12:27 How to Add Bootstrap to an Angular Application
npm start
✔ Compiled successfully.
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 7/10
11/08/2024, 12:27 How to Add Bootstrap to an Angular Application
Forum Donate
Ready! We will access the URL at http://localhost:4200/ and
check if the application is working.
Learn to code You can see
— free 3,000-hour the application
curriculum
working on GitHub Pages and Stackblitz.
Conclusion
Let's summarize what we covered in this article:
You can use this article to create rich and responsive applications
that provide a better user experience and greater usability.
Thank you for reading and I hope you enjoyed the article!
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 8/10
11/08/2024, 12:27 How to Add Bootstrap to an Angular Application
If you read this far, thank the author to show them you care.
Say Thanks
BenQ Indi
Showcase Your C
BenQ Coding M
BenQ India
Our mission: to help people learn to code for free. We accomplish this by creating thousands of
videos, articles, and interactive coding lessons - all freely available to the public.
Donations to freeCodeCamp go toward our education initiatives, and help pay for servers,
services, and staff.
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 9/10
11/08/2024, 12:27 How to Add Bootstrap to an Angular Application
Forum Donate
Trending Guides
Learn to code — free 3,000-hour curriculum
Learn CSS Transform Build a Static Blog Build an AI Chatbot
What is Programming? Python Code Examples Open Source for Devs
HTTP Networking in JS Write React Unit Tests Learn Algorithms in JS
How to Write Clean Code Learn PHP Learn Java
Learn Swift Learn Golang Learn Node.js
Learn CSS Grid Learn Solidity Learn Express.js
Learn JS Modules Learn Apache Kafka REST API Best Practices
Front-End JS Development Learn to Build REST APIs Intermediate TS and React
Command Line for Beginners Intro to Operating Systems Learn to Build GraphQL APIs
OSS Security Best Practices Distributed Systems Patterns Software Architecture
Patterns
Mobile App
Our Charity
About Alumni Network Open Source Shop Support Sponsors Academic Honesty
https://www.freecodecamp.org/news/how-to-add-bootstrap-css-framework-to-an-angular-application/ 10/10