angular - Bootstrap Dropdown Angular 4无法正常工作
问题描述
我正在使用 Bootstrap 下拉列表来显示列表中的内容。第一次将 Bootstrap 与 Angular 4 一起使用,但它不能正常工作。我在“Varukorg”中有三个项目,但它显示在彼此而不是对齐。
<li *ngIf="user.personId != 2">
<div class="dropdown" style="color:gray;">
<span class="glyphicon glyphicon-shopping-cart" style="color:antiquewhite; margin-top:15px;">
</span>
Varukorg
<div class="numberCircle" *ngIf="count != 0">
<h6 style="margin-top:-6px; margin-left:-3px;">{{count}}
</h6>
</div>
<div>
<ul class="dropdown-content" *ngFor="let items of list">
<li style="margin-left:-10px;">
{{items.name}} - {{items.price}}
</li>
</ul>
</div>
</div>
</li>
解决方案
ngFor
应该在 li 元素上并删除自定义边距
<ul class="dropdown-content" >
<li *ngFor="let items of list"">
{{items.name}} - {{items.price}}
</li>
</ul>
推荐阅读
- java - 从 txt 文件中的特定行中提取字符串
- r - 标准化 R 中的字符串
- python - 列表理解比较两个不同的列表
- postgresql - 将十进制转换为字符 postgres
- flutter - flutter_map - 为什么位置在变化,而地图没有移动?
- c# - 用于将给定类型的任何模式转换为通用类型的通用 JSON
- sql-server - 使用 excel vba 和 where 语句从 mssql 中选择数据
- ios - Apple 将停止接受使用 UIWebView API 的应用提交
- oracle - T-SQL 到 PL/SQL - 使用临时变量和“INTO”表达式在 Oracle DB 中搜索查询的总数
- asp.net-mvc - Azure 媒体播放器 - 从中断的地方继续播放