Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set radio button as checked in dart polymer component

I need to show green radio buttons as checked based on model value. HTML has two input elements of type radio:

<input name="color" type="radio" id="red" value="red"></label>
<input name="color" type="radio" id="green" value="green" checked>

Dart code has a variable colorValue='green'. How can the checked attribute of input element be set based on dart variable? Can this be done in HTML or this must be done in dart code?

like image 808
Tusshu Avatar asked Dec 02 '25 01:12

Tusshu


1 Answers

<input ... checked?="{{colorValue=='green'}}">
like image 198
Günter Zöchbauer Avatar answered Dec 03 '25 21:12

Günter Zöchbauer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!