【问题标题】:Angular converting html to angular issueAngular将html转换为角度问题
【发布时间】:2020-12-02 16:03:46
【问题描述】:

我有一个 HTML CSS 主题。我将主题转换为角度一切正常,但侧边栏上的问题我注意到下拉菜单意味着何时单击侧边栏文本菜单需要打开但它没有打开。我需要知道问题是什么?我还没有在项目中安装引导程序,只是导入所有 CSS 图像等并在 angular.json 中导入 CSS 文件

这是侧边栏的小代码

    <li class="nav-item">
        <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseTwo"
            aria-expanded="true" aria-controls="collapseTwo">
            <i class="fas fa-fw fa-cog"></i>
            <span>Components</span>
        </a>
        <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
            <div class="bg-white py-2 collapse-inner rounded">
                <h6 class="collapse-header">Custom Components:</h6>
                <a class="collapse-item" href="buttons.html">Buttons</a>
                <a class="collapse-item" href="cards.html">Cards</a>
            </div>
        </div>
    </li>

我已经添加了 bootstrap、jquery 和 popper.js

"styles": [
  "src/styles.css",
  "src/assets/css/sb-admin-22.css",
  "node_modules/bootstrap/dist/css/bootstrap.min.css"

],
"scripts": [
  "src/assets/js/sb-admin-22.js",
  "src/assets/vendor/jquery-easing/jquery.easing.min.js",
  "src/assets/vendor/jquery/jquery.min.js",
  "src/assets/vendor/bootstrap/js/bootstrap.bundle.min.js",
  "node_modules/bootstrap/dist/js/bootstrap.min.js",
  "node_modules/jquery/dist/jquery.min.js",
  "node_modules/popper.js/dist/popper.js"
] 

【问题讨论】:

    标签: angular angular-ui-bootstrap


    【解决方案1】:

    检查您提供的脚本,例如 angular 和 bootstrap,我们需要在 html 中包含某些脚本

    【讨论】:

      【解决方案2】:

      安装引导程序和 jquery。 “npm i bootstrap”用于引导程序和“npm i jquery” 对于 jquery,然后在您的项目中查找名为 angular.json 的文件,将样式和脚本数组替换如下:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-04-04
        • 2013-05-05
        • 1970-01-01
        • 1970-01-01
        • 2019-07-04
        相关资源
        最近更新 更多