[Solved] How to fill drop down list values using AngularJS


Here is one of possible solutions.

HTML / AngularJS Code:

<div ng-controller="TheController" ng-app>

Location:     
<select ng-model="locationId" ng-options="item.LocationId as item.LocationName for item in locations"></select>
    <br/>         
    LocationId: {{locationId}} <br/>    
</div>

JavaScript:

function TheController($scope) {

    $scope.locations = [
        {LocationId : 1, LocationName : 'USA' },       
        {LocationId : 2, LocationName : 'Canada' },
        {LocationId : 3, LocationName : 'Pakistan' } ];

}

Live Demo: http://jsfiddle.net/8een5/1/

3

solved How to fill drop down list values using AngularJS