Adding Bootstrap in Angular 15
Angular 15 and Bootstrap 5 are widely recognized frameworks, each serving distinct purposes. Angular excels in enabling the development of robust client-side applications, while Bootstrap 5 specializes in enhancing styling and delivering a comprehensive set of components to create polished and feature-rich user interfaces
Angular and Bootstrap are both open-source projects, and they are distributed under the permissive MIT license.
Prerequisites
- HTML
- JavaScript
- TypeScript
Multiple Approaches for Incorporating Bootstrap 5 into Angular 15 :
You can effortlessly generate your Angular application by executing the command provided below :
ng new my-app
ng new my-app
Example 1 :
npm install bootstrap --save
Next, you'll import your Bootstrap CSS into your 'style.css' file, as demonstrated below :
Open style.css or style.scss file in the src folder and paste the above code. this code is imported bootstrap css.
@import "~bootstrap/dist/css/bootstrap.css";
Now you can use Bootstrap in your application angular 15.
Example 2 :
npm install bootstrap --save
npm install jquery --save
npm install popper.js --save
After successfully executing the command mentioned above, proceed to import it into the 'angular.json' file. Open angular.json file and paste this above 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"
]
Now Run The Angular Application check using paste any bootstrap code in your component.
ng serve