Fill a DropDown list using the ng-options directive.
<html>
<body> <div ng-app="myApp" ng-controller="myCtrl"> <select ng-model="selectedName" ng-options="x for x in names"> </select> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.names = ["Delhi", "Pune", "Mumbia","Hyderabad","Noida"]; }); </script> <p>Fill a DropDown list using the ng-options directive.</p> </body> </html> |