How to achieve dynamic class in input helper


Here is a very common scenario:

dynamically change the text input’s class based on the state(hasError or not).

if it is a normal html tag, this can be achieved with if helper inside class declaration:

<input type="text" class="{{if "error"}}">

note: is just a property from controller.

but with input helper, this will cause a building error.

so how can I achieve dynamic class in input helper?


{{input type='text' value='foobar' class=(if showYellow 'yellow' 'blue')}}