This article mainly introducesAngularJS ng-options directive. Here, the knowledge of ng-options directive is compiled in detail, and detailed code examples are attached. Friends in need can refer to it
AngularJS ng-options Directive
AngularJS Example
Filled using arrayelements Drop-down list:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body> <p ng-app="myApp" ng-controller="myCtrl"> <select ng-model="selectedName" ng-options="item for item in names"> </select> </p> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.names = ["Emil", "Tobias", "Linus"]; }); </script> <p>该实例演示了如何使用 ng-options 指令填充下拉列表。</p> </body> </html>
Definition and usage
##ng-options directive is used to use
ng-options directive uses an array to populate a dropdown list, most often used in conjunction with the ng-repeat directive.
Syntax
# The
##
Parameter value
The above is the detailed content of Detailed explanation of AngularJS's ng-options directive. For more information, please follow other related articles on the PHP Chinese website!