【发布时间】:2016-11-15 04:50:36
【问题描述】:
<table *ngIf="datoer">
<tr>
<th>Man</th>
<th>Tir</th>
<th>Ons</th>
<th>Tor</th>
<th>Fre</th>
<th>Lør</th>
<th>Søn</th>
</tr>
<tr>
<td *ngFor="let cell of ukeEn()">
{{cell.text}}
<div class="outer" *ngIf="datoerContains(cell) != null">
<div class="circle" id="circle" *ngFor="let circle of datoerContains(cell)">
// <script>
// document.getElementById("circle").style.background-color = anyFunction();
// </script>
</div>
<div class="details" *ngFor="let circle of datoerContains(cell)">
{{circle.skole}} <br>
{{circle.kommentar}} <br>
SFO: {{circle.sfodag}}
</div>
</div>
</td>
</tr>
</table>
这是用 Angular 2 用 html 编写的。
我想要做的是通过从我的component.ts 文件中调用一个函数来设置circle 类的background color,该函数返回一个类似'red' 的字符串。检查 cmets 我希望它如何工作。
这可能吗?如果是,怎么做?
【问题讨论】:
标签: html css angular typescript