angular - 将多个 div(类)绑定到 Angular 中的动态值
问题描述
在 td 内部,我想使用根据获取的值动态变化的步骤进度条。我可以在 td 中放置步骤进度条,但它是静态的。我没有得到如何动态绑定此步骤进度条。接受和拒绝是获取的值。这是它的外观:包含步骤进度条的最后一个 td 正是我想要动态绑定的。请随时询问是否需要其他任何内容?代码html:
<td style="border-right:1px solid aquamarine;"[class.dot]="user.Manager.status === 'Accepted'"
[class.bluedot]="user.Manager.status === 'rejected'">
{{user.Manager.status}}
</td>
CSS:
.dot{
overflow: hidden;
margin-top:10px;
position: relative;
width: 10px ;
height: 10px ;
border-radius:50%;
background: #66ac3c;
color: white;
text-align: center;
}
步骤进度条的css:
.line {
width: 100%;
float: float;
margin-top:5px;
border-bottom: 1px solid aquamarine;
}
.steps {
box-shadow: 0 0 3px #888;
width: 10px;
height: 10px;
border-radius:50%;
background: #66ac3c;
color: black;
text-align: center;
z-index: 10;
}
解决方案
我认为这必须有效-如果 user.Manager.status 被接受并被拒绝(请参阅上下字母)。任何可以使用 ngClass 的方式
<td style="border-right:1px solid aquamarine;"
[ngClass]="{'dot':user.Manager.status === 'Accepted',
'bluedot':user.Manager.status === 'rejected'}">
{{user.Manager.status}}
</td>
推荐阅读
- django - Django:预取和分页相关对象
- javascript - 由于同步不良导致空字符串响应
- vuejs2 - 如何使用 vuex 正确处理可编辑的复杂对象(嵌套)?
- php - Moodle API - 获取每门课程的所有完成情况
- xslt-3.0 - 使用 xslt-3 使 xml 元素唯一
- ios - iOS swift 4 为复杂的静态变量设置默认布尔值?
- batch-file - Weaken the pattern matching conditions
- python - 替换高于列值的行中的值
- python - 计算聚合模式
- swagger - swagger 3.0 定义模式以防止重复