简体   繁体   English

Bootstrap下拉列表需要使用Angular 2项目的Popper.js

[英]Bootstrap dropdown require Popper.js with Angular 2 project

I've just created an angular 2 project via angular-cli. 我刚刚通过angular-cli创建了一个angular 2项目。 Then I added Bootstrap v4 using command npm install bootstrap@4.0.0-beta.2 provided by Bootstrap official site. 然后我使用Bootstrap官方站点提供的命令npm install bootstrap@4.0.0-beta.2添加了Bootstrap v4

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 : 我已经安装了popper.js并添加到.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 . 我几乎已经使用软件包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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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