Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.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
一些引导功能不';不能在Angular中工作,但可以在常规HTML文件中工作_Angular_Bootstrap 4 - Fatal编程技术网

一些引导功能不';不能在Angular中工作,但可以在常规HTML文件中工作

一些引导功能不';不能在Angular中工作,但可以在常规HTML文件中工作,angular,bootstrap-4,Angular,Bootstrap 4,我刚开始学习角度和引导。我构建了一个Angular项目,然后在事后添加了引导(npm安装引导),然后在其中一个html页面上尝试了各种引导功能。他们中有些人工作,有些人不工作 此问题答案中的代码,例如:。警报将显示,但当我单击X时,它不会消失。奇怪的是,如果我直接在浏览器中访问完全相同的HTML文件,而不是通过服务的页面,那么该功能正常工作 那么我在哪里安装了错误的东西? 以下是我根据互联网上的各种提示所做的一些尝试: 以下是my angular.json的相关部分: "styles":

我刚开始学习角度和引导。我构建了一个Angular项目,然后在事后添加了引导(npm安装引导),然后在其中一个html页面上尝试了各种引导功能。他们中有些人工作,有些人不工作

此问题答案中的代码,例如:。警报将显示,但当我单击X时,它不会消失。奇怪的是,如果我直接在浏览器中访问完全相同的HTML文件,而不是通过服务的页面,那么该功能正常工作

那么我在哪里安装了错误的东西? 以下是我根据互联网上的各种提示所做的一些尝试: 以下是my angular.json的相关部分:

    "styles": [
    "node_modules/jquery/dist/jquery.js",
    //"node_modules/tether/dist/js/popper.js",
    "src/styles.scss",
    {
        "input": "./node_modules/bootstrap/dist/css/bootstrap.css"
    }
    ],
My styles.css包含:

    @import url('https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css');
    @import "~bootstrap/dist/css/bootstrap.css";
  • 脚本
    属性中导入JavaScript文件,而不是在
    样式
    属性中导入
  • 。。。
    “脚本”:[
    “./node_modules/jquery/dist/jquery.min.js”,
    “./node_modules/bootstrap/dist/js/bootstrap.min.js”
    ]
    ...
    
  • 不要两次导入CSS文件
  • @import“~bootstrap/dist/css/bootstrap.css”;
    
    Bootstrap依赖于jQuery功能,由于角度渲染的动态特性,jQuery功能通常无法正确使用角度渲染。只需使用ng引导,因为它是专门设计用于工作角度。谢谢,这工作!(除非我移除了../before节点_模块,使其指向正确的位置)