ng-selected

Description

We can use ng-selected to bind the presence or not of the selected attribute to the option tag.

Example

The following code shows how to ng-selected.


<!--   w  ww.  ja va 2 s .c  o m-->
<!doctype html>
<html ng-app="myApp">
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular.js"></script>
</head>
<body>
  <input type="checkbox" ng-model="isB" >check me to select B</input><br/>
  <select>
    <option ng-selected="!isB">A</option>
    <option ng-selected="isB">B</option>
  </select>

  <script>
    angular.module('myApp', [])
  </script>

</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Tutorial »




Introduction
Buildin Filters
Buildin Directives