Ng-Options-With-Id-And-Name

 
 
 
<!DOCTYPE html> <html lang="en-US"> <head> <title>Welcome in the Angular JS</title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.0-rc.1/angular.min.js"></script> </head> <body ng-app="sampleApplication"> <div ng-controller="sampleController"> <select ng-model="empId" ng-options="emp.id as emp.name for emp in employees"></select> </div> <script> var app = angular.module("sampleApplication", []); app.controller("sampleController", function ($scope) { $scope.employees = [{ name: "Valenti", age: "25", phoneNumber: "563544466" }, { id: 1, name: "Wilcox", age: "34", phoneNumber: "657865856" }, { id: 2, name: "Yutang", age: "27", phoneNumber: "679423435" }, { id: 3, name: "Kraus", age: "25", phoneNumber: "343667789" }]; }); </script> </body> </html>
Output