简体   繁体   English

如何在angular 4应用程序中安装bootstrap 4版本beta.2?

[英]How to install bootstrap 4 version beta.2 in an angular 4 application?

I tried installing bootstrap 4 version beta.2 and its dependencies (jquery and popper.js). 我尝试安装bootstrap 4版本beta.2及其依赖项(jquery和popper.js)。 but there is something very weird going on. 但是发生了一件很奇怪的事情。 for some reason, I keep getting an error message in the console, saying "SyntaxError: export declarations may only appear at top level of a module". 由于某种原因,我在控制台中不断收到一条错误消息,提示“ SyntaxError:导出声明​​可能仅出现在模块的顶层”。 when I click to go to the line that's causing this issue in the scripts.bundle.js, I find that it's the popper.js package that's causing this issue. 当我单击以转到在scripts.bundle.js中导致此问题的行时,我发现是导致该问题的是popper.js程序包。

I have included the script references to my angular-cli.json file as follows: 我已经包含了对我的angular-cli.json文件的脚本引用,如下所示:

 "scripts": [
    "../node_modules/jquery/dist/jquery.slim.min.js",
    "../node_modules/popper.js/dist/esm/popper.min.js",   
    "../node_modules/bootstrap/dist/js/bootstrap.min.js",
    "../node_modules/alertifyjs/build/alertify.min.js"
  ]

I think I did everything right, but I don't know why the issue with popper is occuring. 我认为我所做的一切都正确,但是我不知道为什么Popper问题会发生。

Please help me find an answer to this. 请帮助我找到答案。

If you are running Angular CLI. 如果您正在运行Angular CLI。 Then use 然后使用

npm install ngx-bootstrap --save

FYR: Bootstrap 4 in Angular CLI FYR: Angular CLI中的Bootstrap 4

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

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