Angular 使用带角度4的引导4

Angular 使用带角度4的引导4,angular,tether,Angular,Tether,在安装引导程序4之后,在Angular 4中,我得到一个错误: [脚本加载程序]错误:引导工具提示需要系带()。 我尝试安装tether,并传递tether CDN,但没有任何帮助。在angular-cli.json文件中添加对tether.min.css的引用 styles": [ "styles.css", "../node_modules/tether/dist/css/tether.min.css", "../node_modules/bootstrap/dist

在安装引导程序4之后,在Angular 4中,我得到一个错误: [脚本加载程序]错误:引导工具提示需要系带()。
我尝试安装tether,并传递tether CDN,但没有任何帮助。

在angular-cli.json文件中添加对tether.min.css的引用

styles": [
    "styles.css",
    "../node_modules/tether/dist/css/tether.min.css",
    "../node_modules/bootstrap/dist/css/bootstrap.min.css"
  ],
  "scripts": [
    "../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/tether/dist/js/tether.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.min.js"
  ],

观看视频或按照步骤进行操作

在项目中包括引导有两种方法
1) 在index.html文件中添加CDN链接
2) 使用npm安装引导程序

npm install bootstrap@next --save
我建议您使用npm安装以下两种引导方法,因为它在您的项目目录中可用

1) 使用npm安装引导程序

npm install bootstrap@next --save
在安装Bootstrap4之后,我们需要另外两个javascript包,即Jquery和Popper.js,如果没有这两个包,Bootstrap是不完整的

2) 安装JQUERY

npm install jquery --save
3) 安装Popper.js

npm install popper.js --save
现在,引导程序安装在节点\u模块文件夹中的项目目录中

打开.angular cli.json此文件在您的angular目录中可用打开该文件并在样式[]和脚本[]路径中添加bootstrap、jquery和popper.js文件的路径请参见下面的示例

"styles": [   
    "../node_modules/bootstrap/dist/css/bootstrap.min.css",
    "styles.css"
  ],
  "scripts": [  

    "../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.min.js",
    "../node_modules/popper.js/dist/umd/popper.min.js"
  ],
注意:不要更改js文件的序列,应该是这样的


现在引导程序工作正常

是否显示您的代码?根据你所说的,它应该是有效的。确保在引导之前包含Tether。经过多次尝试和错误,我发现了这个网站。这很有帮助。我在bootstrap.min.js之前添加了tether.min.js,修复了错误。我很高兴它起了作用。祝您度过愉快的一天;)回答不正确,引导4使用提升器,而不是系带