I need assistance with a dropdown list issue. See the code snippet below:
My Controller
(function(angular) {
'use strict';
angular.module('ngrepeatSelect', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.data = {
model: null,
availableOptions: [
{id: '1', name: 'Option A'},
{id: '2', name: 'Option B'},
{id: '3', name: 'Option C'}
]
};
$scope.data.model=1;
}]);
})(window.angular);
My UI
<body ng-app="ngrepeatSelect">
<div ng-controller="ExampleController">
<form name="myForm">
<label for="repeatSelect"> Repeat select: </label>
<select name="repeatSelect" id="repeatSelect" ng-model="data.model">
<option ng-repeat="option in data.availableOptions" value="{{option.id}}">{{option.name}}</option>
</select>
</form>
<hr>
<tt>model = {{data.model}}</tt><br/>
</div>
</body>
Check out this demo. Despite setting $scope.data.model
to 1
, the dropdown list appears blank.
I've attempted various solutions without success. Any help is appreciated. Thank you and excuse my language skills.
Edit Note : I previously tried following this guide, but the issue persists.