【发布时间】:2015-10-27 22:36:25
【问题描述】:
我正在使用ng-repeat 从数组中简单地放下选项。不过,我希望我做得很好,我在选择选项的下拉列表中看不到任何选项。有人可以帮我找出错误吗?
var myApp = angular.module("myApp", []);
myApp.controller('myCtrl', function($scope) {
$scope.Country = [
"India","Pakistan","Germany"
];
});
<html>
<head>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<select>
<option ng-repeat="x in Country"></option>
</select>
</body>
</html>
【问题讨论】:
-
<option ng-repeat="x in Country">{{x}}</option>你没有打印价值,就是这样! -
@Eric - 你如何从代码中制作这些 sn-ps?我也想这样做
标签: javascript arrays angularjs angularjs-ng-repeat