0
誰かが私の問題を理解するのを助けてくれることを願っています。私はいくつかの配列データでコンボボックスを埋めることを試みていますが、空のコンボボックスが表示されるために何も返されないようになっています。私は閉じていますが、見つからないものを見つけることができます。Angularjs - comboBoxを動的に入力する(Array())
は、あなたのangularjs参照が間違っているようだ
angular.module('demoApp', [])
.controller('simpleController', ['$scope', function($scope) {
$scope.employeeCollections = [
{ id:'1',name: 'Dave Jones', title: 'IT Administrator' },
{ id:'2',name: 'Daniel Thomas', title: 'Software Developer' },
{ id:'3',name: 'Sam Alexandrovic', title: 'Senior Software Developer' }
];
$scope.selectedEmployee = $scope.employeeCollections[0].name;
}]);
<html ng-app="demoApp">
<head>
<script src="Scripts/angular.min.js"></script>
</head>
<body>
<h1> Employee Information </h1>
<div class="container" ng-controller="simpleController">
<select ng-model="selectedEmployee" ng-options="employee as employee.name for employee in employeeCollections"></select>
</div>
</body>
</html>