<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.5.6" data-semver="1.5.6" src="https://code.angularjs.org/1.5.6/angular.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<h1>Angular ng-option</h1>
<p>
Demonstrate uses of ng-options
</p>
<div ng-app="myApp">
<div ng-controller="controller">
<select ng-model='mycustomer' ng-options="customer.name for customer in customers">
</select>
You have selected : {{mycustomer.name}} with id {{mycustomer.id}}
</div>
</div>
</body>
</html>
var app = angular.module('myApp', []);
app.controller('controller',['$scope', function ($scope)
{
$scope.counter = 0;
$scope.name = 'jeremy';
$scope.customers = [
{
id : 1,
name: 'David',
street: '1234 Anywhere St.'
},
{
id : 2,
name: 'Marry',
street: '456 Anywhere St.'
},
{
id : 3,
name: 'Alex',
street: '789 Anywhere St.'
}
];
$scope.mycustomer = $scope.customers[1];
}]);
/* Styles go here */