So my file.json is :
[
{
'id' : 1,
'name' : 'img/1.jpg'
},
{
'id' : 2,
'name' : 'img/2.jpg'
},
{
'id' : 3,
'name' : 'img/3.jpg'
},
{
'id' : 4,
'name' : 'img/4.jpg'
},
{
'id' : 5,
'name' : 'img/5.jpg'
}
]
And my controller is :
app.controller("MyCtrl", ["$scope", "$http", function($scope, $http){
$http.get("file.json").then(function(data){
$scope.template = data;
});
}]);
So from my html page im calling the controller and doing a ng-repeat but not working:
<div class="container" ng-controller="MyCtrl">
<div ng-repeat="path in template.names">
<div class="inner">
<img ng-src="{{path.name}}">
</div>
</div>
I keep getting error in console:
