【问题标题】:Bootstrap collapse menu doesn't work with angular引导折叠菜单不适用于角度
【发布时间】:2019-03-27 17:10:24
【问题描述】:

我在使用 bootstrap 和 angular 使菜单的“折叠”效果工作时遇到问题,我设置了单独的布局并且一切正常,但是,当我添加 angular 时,菜单根本不起作用。

我一直在阅读,我看到可能存在一些冲突,我看到了一些将“href”替换为“data-target”的提示,但没有任何效果,我需要你的帮助。

html

  <!-- Inicio Sidebar -->
  <div class="col-sm-2" id="sidebar-collapse"> 
      <div class="nav-side-menu bg-dark" >

          <div class="sidebar-profile-pic"></div>
          <span class="nav-link sidebar-profile-name">Douglas Nickson</span>
          <div class="divider"></div>

          <ul class="nav" style="display:block;">
              <li><a href="index.html"><i class="fa-lg fa fa-dashboard" aria-hidden="true"></i> Dashboard</a></li>
              <li class="parent"><a data-toggle="collapse" href="#modulo-item-1">
                  <i class="fa-lg fa fa-book">&nbsp;</i> Modulo <span data-toggle="collapse" href="#sub-item-1" class="icon pull-right"><em class="fa fa-plus"></em></span></a>
                  <ul class="children collapse" id="modulo-item-1">
                      <li><a class="" href="cadastrar-modulo.html">
                          <span class="fa fa-arrow-right">&nbsp;</span> Cadastrar Modulo
                      </a></li>
                      <li><a class="" href="#">
                          <span class="fa fa-arrow-right">&nbsp;</span> Gerenciar Modulo
                      </a></li>
                  </ul>       
              </li>
            </ul>
    </div>
   </div>

angular-cli.json

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

我已经安装了引导程序和我使用的依赖项,但它仍然无法正常工作,有什么提示可以解决这个问题吗? 谢谢。

【问题讨论】:

  • valor-software.com/ngx-bootstrap/#/collapse 参考这个。 Angular 项目不支持 Jquery。所以最好使用 ngx-bootstrap
  • 我之前也遇到过类似的问题,我最终将 cdn 用于 bootstrap 4。所以据我所知,我下载的版本不是最新的,因此我得到了那个和你类似的问题。希望这会有所帮助
  • @cacev000 感谢您的帮助,但我正在使用最新版本的引导程序,我正在尝试使用上面这些人的提示。

标签: angular twitter-bootstrap bootstrap-4


【解决方案1】:

正如 Ismail Farooq 已经建议的那样,我已经从这里 ng-bootstrap.github.io/#/home 安装了 ng-bootstrap 然后使用了他们的折叠组件enter link description here

【讨论】:

    猜你喜欢
    • 2020-03-12
    • 2015-04-19
    • 1970-01-01
    • 2020-10-31
    • 2015-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-18
    相关资源
    最近更新 更多