Currently working on Angular. I am trying to get the data from JSON file and I am showing the result in Ul format. When I searched in Stack Overflow, I found this link. I am trying to do the same but still I am not solving it.
This is what I am trying here in the controller:
'use strict';
var app = angular.module('myApp', []);
app.controller('MyController', function($scope, $http){
$http.get('sample.json').then(function (response){
$scope.items = response.data.countries;
});
});
HTML code:
<body ng-app="myApp">
<div ng-controller="MyController">
<ul>
<li ng-repeat="(key, value) in items" {{key}}>
</li>
</ul>
</div>
</body>
Here is my plunker. What am I doing wrong here?
{{ key }}as attribute inside li tag