I have a simple json file with a list of artist names, like
["Vincent van Gogh", "Leonardo da Vinci", "Pablo Picasso"]
I can't figure out how to load this external json file into an angularjs array and use ng-repeat on it. The non-working code I tried is:
<tr ng-repeat="artist in artists">
<td>{({ artist })}</td>
<td></td>
</tr>
<script>
var artApp = angular.module('artApp', []);
artApp.config(function($interpolateProvider){
$interpolateProvider.startSymbol('{({').endSymbol('})}');
});
artApp.controller('mycontroller', function($scope,$http){
$scope.artists = [];
$http.get('/home/user/artist_names.json').success(function(data) {
angular.forEach(data.MainRegister,function(entry) {
$http.get(entry.url).
success(function(data) {
$scope.artists.push(angular.extend(entry,data.SubInformation);
});
});
});
});
</script>
Not only does this controller code not work, but it breaks my $interpolateProvider
code and makes the html actually display my raw angular variables.