Javatpoint Logo
Javatpoint Logo

AngularJS ng-selected Directive

The AngularJS ng-selected directive adds the selected attribute on the element, if it gets that the expression inside ng-selected is true.

The ng-selected directive is necessary to makes you able to shift the value between true and false. In HTML, the selected attribute cannot be set to false.

It is supported by <option> element.

Syntax:

Parameter explanation:

expression: It specifies an expression that will set the element's selected attribute if it returns true.

Let's take an example to demonstrate the usage of ng-selected directive.

See this example:

Test it Now



Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA