我试图根据表单的状态和验证条件,使表单无效时显示红色文本,并在表单有效时显示绿色。如何通过角度8实现此目标?
(HTML)
scala> m.map( x=> (x._1,x._2)).toList.sortBy(_._1).filter( _._1<=95 ).last
res74: (Int, String) = (90,A)
scala> m.map( x=> (x._1,x._2)).toList.sortBy(_._1).filter( _._1>=95 ).head
res75: (Int, String) = (100,I)
scala>
(TS)
<p class="status">
Form Status: {{ Form.status }}
</p>
答案 0 :(得分:1)
创建无效类的CSS并将html调整为:
<p class="status">
Form Status:
<span [class.invalid-class]="Form.invalid">
{{ Form.status }}
</span>
</p>