user172902
user172902

Reputation: 3601

Angular 2 Bootstrap 4 and ng-bootstrap

I am abit confused as to what is the need for ng-bootstrap built by angular team if we can use bootstrap 4 class straight out of the box (with containers and modals?) I have been using both ng-bootstrap and bootstrap 4 syntax at various places for not particular reason and it is becoming a mess...Is there a general rule for using either?

Upvotes: 3

Views: 832

Answers (1)

Devner
Devner

Reputation: 7255

One of the main reasons for using ng-bootstrap would be the JavaScript compatibility part.

The regular Twitter Bootstrap relies on jQuery for data manipulation. It also manipulates the state of elements by setting classes such as ".active" or by removing it from an existing element.

On the other hand, ng-bootstrap does NOT require jQuery to run. All the elements are built from ground up using code that would not require jQuery and would play nicely along with Angular Core. It also helps retain the look and feel of Bootstrap components by making use of Bootstrap CSS file.

To summarize, if you use Twitter Bootstrap, you rely solely on jQuery for JavaScript. When you are using ng-bootstrap, you are moving away from jQuery domain completely and you would be relying purely on AngularJS to provide you with the functionality part of it. The only thing that ng-bootstrap and Twitter Bootstrap have in common would be the CSS styling for the elements.

Hope this clears the confusion.

Upvotes: 3

Related Questions