Sunday, October 7, 2012

AngularJS Select Input

In HTML template

<select ng-model="langId" ng-options="lang.id as lang.name for lang in languages">
</select>

In the controller

$scope.languages = [
   {id:'en', name:'English'},
   {id:'zh', name:'Chinese'}, etc....
   ];

Example fiddle: http://jsfiddle.net/2JWb2/5/

No comments:

Post a Comment