如何在Angular 4应用程序中安装Bootstrap 4版本Beta.2



我尝试安装Bootstrap 4版本beta.2及其依赖项(jQuery and popper.js)。但是发生了一些非常奇怪的事情。由于某种原因,我一直在控制台中收到错误消息,说" Syntaxerror:导出声明可能只出现在模块的顶级"。当我单击到脚本中引起此问题的行时,我发现是popper.js软件包引起了此问题。

我已将脚本引用到我的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"
  ]

我认为我做对了,但是我不知道为什么要出现Popper的问题。

请帮助我找到答案。

如果您正在运行Angular CLI。然后使用

npm install ngx-bootstrap --save

fyr:Angular Cli

中的Bootstrap 4

最新更新