So basically when I was using native html5 i was using five <img src=""> tags to load five images. When i wanted to use AngularJS i thought of iterating a div five times through ng-repeat and using ng-src="" get the image whose source path is stored in an array in the controller. But some how im always getting this error GET file:///home/sanad/Desktop/drag/x.source net::ERR_FILE_NOT_FOUND
This is my html:
<div ng-repeat="x in img">{{x.source}}
<img ng-id="x.id" ng-src="x.source" >
</div>
This is my js:
var app=angular.module('d2d',[]);
app.controller('imageCtrl',function($scope){
$scope.img=[
{id:'table',source:'images/table.jpg'},
{id:'paper',source:'images/paper.jpg'},
{id:'computer',source:'images/computer.jpg'},
{id:'ac',source:'images/ac.jpg'},
{id:'sofa',source:'images/sofa.jpg'}
];
});
<div data-ng-repeat="i in images"><div style="background:url(imgs/{{i.srcimg}})"></div></div>