151
rated 0 times
[
154]
[
3]
/ answers: 1 / hits: 9206
/ 10 Years ago, fri, june 27, 2014, 12:00:00
my document.json file contains data like
[
{name :B},
{name :A},
{name :D},
{name :E}
]
when i try to display the json data in drop-down list, the last element E
only displayed in drop down .my html file like
<select ng-model=selectedTestAccount ng-options=c as c.name for c in testAccounts></select>
and my script file like
sampleApp.controller('DemoCtrl', function ($scope, $http) {
$scope.selectedTestAccount = null;
$scope.testAccounts = [];
$http.get('document.json').success(function (data) {
$scope.testAccounts = data;
});
});
How can i display this document.json data in drop-down list with default selected as first element in AngularJS. Any guidelines please
More From » json