【发布时间】:2020-07-18 03:11:29
【问题描述】:
[我想将拆分值的第0个索引绑定到ngclass。 我不能在后端这样做。我必须在 .html 本身中执行此操作。有什么帮助吗?
在 .ts 文件中
response = "success&2018-12-19 09:26:03";
this.status = response;
在 .html 页面中
<div ngClass="row.status.split['&'][0]">{{row.status.split['&'][1]}}</div>
在 .scss 文件中
.success {
background-color: #4A993A;
height:25px; width:200px;
border-radius:4px;
color: white;
margin-right: 9px;
text-align: center;
padding-top:3px;
}
我不知道如何为动态拆分值的 ngclass 提供正确的语法。
【问题讨论】:
-
能否提供示例代码?我们很容易复制。
标签: typescript sass