Disclaimer: I am a consultant at Amazon Web Services, and this is my personal blog. The opinions expressed here are solely mine and do not reflect the views of Amazon Web Services (AWS). Any statements made should not be considered official endorsements or statements by AWS.
Adding the Bootstrap library to an Angular application is quite easy. Bootstrap Library consists of both CSS & JS files.
Now, let's understand - How can we add the bootstrap library to the Angular application?
First, open angular CLI & hit the below command.
This will install bootstrap node module in your application inside node_modules folder.
There are two ways to add bootstrap CSS to the application.
Open angular.json file & add bootstrap CSS file reference in styles array.
Open styles.css file which is present in the src folder & add an import statement like the below.
Bootstrap JavaScript components depend upon two other JavaScript libraries - jQuery & popper.js. So first, we have to install these two dependencies from npm.
After this, open angular.json file & update the scripts section like below:
So far, we have added the bootstrap JavaScript library to the application. But we might need to call some methods of this library such as modal('show') to show the modal popup, tab('show') to activate a tab.
To access these methods of bootstrap library & get proper IntelliSense support in Visual Studio Code IDE, we should install types for jQuery & Bootstrap libraries.
tsconfig.json - Look into this file for types array and add jquery and bootstrap entries.
That's all :)