Angular 5 with Bootstrap 4 not working

后端 未结 7 742
粉色の甜心
粉色の甜心 2021-02-04 18:50

I created a new Angular 5 project. After that I followed instructions given on Angular CLI GitHub page to use Bootstrap 4.0.0 with Angular 5.2.2. I use \'npm install bootstrap\'

7条回答
  •  时光取名叫无心
    2021-02-04 19:27

    Bootstrap has dependency on popper and jquery. It is always a good idea to install these modules along with bootstrap.

    npm install --save bootstrap@4 jquery@version popper@version
    

    using --save adds these dependencies in your package.json.

    Then you can go to angular.json (Angular 6 and cli v6) or angular-cli.json (Angular 5 or below and cli v1.7) and paste the css of bootstrap in node modules under styles array. And add jquery, popper and bootstrap.js files under scripts.

    Hope that helps!

提交回复
热议问题