【发布时间】:2019-02-23 01:08:55
【问题描述】:
bootstrap4 https://getbootstrap.com/docs/4.0/components/collapse/#accordion-example 提供手风琴控制
当我尝试将它与我的 angular 6 应用程序一起使用时,它不会崩溃。浏览器中没有错误,但它不起作用。对这个有什么想法吗?
html
<div class="accordion" id="accordionExample">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Collapsible Group Item #1
</button>
</h5>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
**** 编辑 ****
这是实时代码示例 https://stackblitz.com/github/Rugved/ng6bt4Demo/
***** 编辑 **** jquery 包含在 angular.json 文件中
"styles": [
"src/styles.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/popper.js/dist/umd/popper.min.js",
"node_modules/bootstrap/dist/js/bootstrap.js"
]
【问题讨论】:
-
抱歉,您能进一步解释一下吗?这只是引导代码,没有需要观察的 api 调用。
-
对不起!!删除了之前的评论。我是为了其他问题
-
你能检查一下你是否在 package.json 中包含了引导依赖项吗?
-
是的,如果你检查链接,你可以看到引导样式被应用
-
@SubSUl 提到的请包括 jQuery
标签: angular bootstrap-4 angular6 collapse