简体   繁体   中英

Bootstrap dropdown require Popper.js with Angular 2 project

I've just created an angular 2 project via angular-cli. Then I added Bootstrap v4 using command npm install bootstrap@4.0.0-beta.2 provided by Bootstrap official site.

Anyway, everything works except for the following error in console window :

Uncaught Error: Bootstrap dropdown require Popper.js (https://popper.js.org)
    at scripts.bundle.js:179
    at scripts.bundle.js:588

I've installed popper.js and added inside .angular-cli.json :

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

But still the error is there!

I've almost solved the problem using package npm install ngx-bootstrap --save .

Of course it's not the direct way, Nevertheless it works properly.

I had the same error.

Try running:

npm install --save bootstrap@4.0.0-alpha.6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM