Can't bind dropdown with List in AngularJS:
<select>
<option ng-repeat="x in list">{{x}}</option>
</select>
app.controller('myCtrl', function($scope) {
$Scope.list=[{id:1, name='name 1'},{id:2, name='name 2'}];
});
Try it with a right object and use the correct name of $scope while object names are case sensitive in JavaScript. Check this runnable fiddle demo and compare it with your solution.
app.controller('myCtrl', function($scope) {
$scope.list = [{
id: 1,
name: 'name 1'
},{
id: 2,
name: 'name 2'
}
];
});
<select>
<option ng-repeat="x in list" value="x.id">{{x.name}}</option>
</select>
try to do like this:
Json object was wrong:
app.controller('myCtrl', function($scope) {
$scope.list=[{id:1, name:'name 1'},{id:2, name:'name 2'}];
});
<select>
<option ng-repeat="x in list">{{x.name}}</option>
</select>
Or,
<select ng-model="selectedItem" ng-options="item for item in list">
</select>
$scopenot$Scope