<!DOCTYPE html>
<p>Select a car:</p> <select ng-model="selectedCar" ng-options="x.model for x in cars"> <h1>You selected: {{selectedCar.model}}</h1> </div> <script> <p>When you use the ng-options directive to create dropdown lists, the selected value can be an object.</p> </body> </html> |
Select a car: You selected: {{selectedCar.model}}Its color is: {{selectedCar.color}} When you use the ng-options directive to create dropdown lists, the selected value can be an object. In this example you can display both the model and the color of the selected element. |