dart - How do I set a default selected option in a Web UI <select> tag? -


i have have <select> tag few options. how set default selected option?

here dart code:

import 'dart:html'; import 'package:web_ui/web_ui.dart';  list<string> fruits = const <string>['apples', 'bananas', 'pears'];  @observable string selected = 'pears';  void main() { } 

here html code:

<p>hello world dart!  chose {{ selected }}</p>  <select name="fruit" template iterate="fruit in fruits" bind-value="selected">   <option selected="{{selected == fruit}}">{{fruit}}</option> </select> 

note, there open request make bit easier. in meantime, above code should work you.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -