I'm working on a project that uses Angular 11, we want to use Bootstrap 5 native JS, without third parties like ng-bootstrap, MDB, or ngx-bootstrap (We are not using jQuery as well). I know using JS libraries on TS is not ideal.
The problem is how to import Bootstrap JS and use its objects and methods in Angular's TS components.
Initially I thought installing the following packages would be enough:
npm i bootstrap@next
npm i @types/bootstrap
Both have been imported in the package.json and are available in node_modules. I've also imported "scripts": [ "node_modules/bootstrap/dist/js/bootstrap.js" ] inside of angular.json, but I still cannot use them.
For example, if I do:
import { Carousel } from 'bootstrap';
...
carousel: Carousel | any;
...
this.carousel = document.getElementById('video-carousel')
this.carousel.interval = false;
Where 'bootstrap' is '@types/Bootstrap'. The carousel shouldn't cycle automatically, but it does. This happens with every other Bootstrap type.