This article mainly introduces the advanced usage of the drop-down box in AngularJS, and analyzes the traversal, selection, binding, display and other functions of the AngularJS drop-down box in the form of examples. Friends in need can refer to the following
The examples in this article describe the advanced usage of drop-down boxes in AngularJS. Share it with everyone for your reference, the details are as follows:
HTML text:
##
{{sites}}
选择的网址:{{site}}
选择一辆车:
你选择的是: {{selectedCar.brand}}
型号为: {{selectedCar.model}}
颜色为: {{selectedCar.color}}
下拉列表中的选项也可以是对象的属性。
Javascript operation code:
var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { //复杂对象 $scope.cars = { car01 : {brand : "Ford", model : "Mustang", color : "red"}, car02 : {brand : "Fiat", model : "500", color : "white"}, car03 : {brand : "Volvo", model : "XC90", color : "black"} } //简单对象 $scope.sites = { site01 : "Google", site02 : "Baidu", site03 : "Taobao" }; }); app.controller("myctr01",function($scope){ $scope.sites = { site01 : "Google", site02 : "Baidu", site03 : "Taobao" }; });
The above is the detailed content of Detailed introduction to the advanced usage of drop-down boxes in AngularJS. For more information, please follow other related articles on the PHP Chinese website!