Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将jquery与Angular 4结合使用_Jquery_Angular_Typescript_Bootstrap 4 - Fatal编程技术网

将jquery与Angular 4结合使用

将jquery与Angular 4结合使用,jquery,angular,typescript,bootstrap-4,Jquery,Angular,Typescript,Bootstrap 4,我想显示一个引导模式,但我仍然得到 SectionDetailComponent.html:54 ERROR TypeError: $(...).modal is not a function My.cli: "scripts": [ "../node_modules/jquery/dist/jquery.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js" ], 我的组成部分: declare var

我想显示一个引导模式,但我仍然得到

SectionDetailComponent.html:54 ERROR TypeError: $(...).modal is not a function
My.cli:

"scripts": [
    "../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.min.js"
  ],
我的组成部分:

declare var jquery:any;
declare var $:any;
已解决:

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

您应该尝试使用ngx bootstrap或ng bootstrap来使用bootstrap 4,而不是使用常规的bootstrap.js。它是专门为Angular 4设计的谢谢你的回答,我真正的问题是Popper.js,我只需要在jquery之后和Bootstrap之前添加内部脚本。与Bootstrap+jquery相比,ng Bootstrap或ngx Bootstrap的通用版本在Angular上工作得更好、更自然。注意:我没有在这里否决任何东西。老实说,甚至没有必要将jquery与angular一起使用。Angular的内置libs可以完成jquery所做的一切。