<div ng-init="loadImage('/image/load/', event.listfile)"></div> In the event.listfile :
[ {id: 797, filename: "image1.jpg"}, {id: 800, filename: "image12.jpg"}, {id: 798, filename: "image47.jpg"} ] Controller:
$scope.loadImage = function(path, name) { $scope.image = []; name.forEach(function (element, index) { $scope.image.push({"filename": path +name[index]}); }); console.log('image: ', $scope.image); } Why the controller returns to the console instead of file names [object Object] :
/image/load/[object Object] /image/load/[object Object] /image/load/[object Object]
/image/load/[object Object]? - Grundy