Bootstrap 4 Navbar doesnt collapse in Angular4

后端 未结 4 650
时光说笑
时光说笑 2021-01-14 05:37

I\'m working with Bootstrap 4 and Ng-Bootstrap in an Angular 4 Project,

i have linked the que bootstrap.css in my angular-cli.json this way

 \"styles         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-14 06:14

    I had the same problem, I used normal bootstrap 4 rather then ng-bootstrap and this way I don't need to any module in app.module file as well. it works. Below is the script add into angular.json (angular v6) and bootstrap 4+:

    "scripts": ["../node_modules/jquery/dist/jquery.js",
                "../node_modules/popper.js/dist/umd/popper.js", 
                 "../node_modules/bootstrap/dist/js/bootstrap.js"]
    

    For CSS I prefer to use Scss version so it goes like this.

    "styles": [
                  "src/styles.scss",
                  "../node_modules/font-awesome/scss/font-awesome.scss"
                ],

    and i import bootstrap into style.scss file

    @import "~bootstrap/scss/bootstrap.scss";

    Cheers! JK

提交回复
热议问题