Angular.dart 1.X Default value in Select BOX

Issue

How to define the default selected options in the select box.
I’m able to display my options like this :

<select ng-model="selectedOptionId">
  <option value="">Select Option</option>
  <option ng-repeat="o in options" value="{{o.id}}">
    {{o.name}}
  </option>
</select>

But I am not able to define the default selected value

Solution

You can set it in your component’s Dart file, since selectedOptionId is your model.

selectedOptionId = 3 //assuming o.id = 3 is your default

Answered By – Liew Jun Tung

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *