Angular2 - Set A Different Color to an element Depending On Value

前端 未结 5 1293
臣服心动
臣服心动 2020-12-06 02:28

I am new to Angular2 and was wondering how I go about setting a font color to an element depending on the value.

My scenario is: if the value of the inp

5条回答
  •  心在旅途
    2020-12-06 02:56

    Since you use Angular2, So you need to use [ngClass], and your input model is bind to proportion, So use it to compare,

    Do it like :

    
    

    hello {{username}}

提交回复
热议问题