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.


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

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA