Latest web development tutorials

AngularJS ng-selected instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS examples

Being selected option:

Click the checkboxes to select BMW options:
<Input type = "checkbox" ng -model = "mySel">

<P> My favorite car: </ p>

<Select>
<Option> Volvo </ option>
<Option ng-selected = "mySel "> BMW </ option>
<Option> Ford </ option>
</ Select>

try it"

Definition and Usage

ng-selected command is used to set the <select> list <option> selected attribute of the element.

ng-selected expression property returns true if the option is selected.


grammar

<Option ng-selected = "expression "> </ option>

<Option> element supports the instruction.


Parameter Value

value description
expression If the expression is true then the option is selected

AngularJS Reference Manual AngularJS Reference Manual