How to use ngx-bootstrap in Angular

ngx-bootstrap is a flexible library built on top of Angular to be used in Angular. It uses Bootstrap library to provide its components styling.

Step 1: Install library

It is assumed that you have already created an Angular application.

Install the ngx-bootstrap package using command below:

npm install ngx-bootstrap --save

Step 2: Import required packages

Next step is to import required packages in main module file. You can import as much packages you need, but it is not advisable to import unnecessary packages.

For ex. you need AlertModule then import it like this:

 

Step 3: Use template

The next step is to use template code to see the result.

The result will be displayed like this:

Conclusion:

ngx-bootstrapis a styling library to provide bootstrap features in Angular. It uses bootstrap css framework internally to display the modules. The library is easy to use in live as well as any educational purpose projects.

Leave a Reply

Your email address will not be published. Required fields are marked *