1

I need some help.i need to display multiple image and when also user will select the image it will push into array.I am explaining my code below.

<div class="input-group bmargindiv1 col-md-12" ng-repeat="mul in mulImage">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Image{{$index+1}}:</span>
<div>
<div ng-class="{'myError': billdata.upload_{{$index}}.$touched && billdata.upload_{{$index}}.$invalid }">
 <input type="file" class="filestyle form-control" data-size="lg" name="upload_{{$index}}" id="bannerimage_{{$index}}"  ng-model="mul.image" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="2MB" ngf-min-height="400" ngf-resize="{width: 400, height:400}"  ngf-select="onFileSelect1('upload_{{$index}}',mul.image);">
<div style="clear:both;"></div>
 <input type="text" id="hidn_{{$index}}" ng-model="attach_{{$index}}" style="display:none" />
 </div>
 </div>
<span class="input-group-btn" ng-show="mulImage.length>0">
 <img ngf-thumbnail="mul.image" name="pro" border="0" style="width:32px; height:32px; border:#808080 1px solid;">
 <input type="button" class="btn btn-success" name="plus" id="plus" value="+" ng-click="addNewImageRow(mulImage);" ng-show="$last"> <input type="button" class="btn btn-danger" name="minus" id="minus" value="-"  ng-show="mulImage.length>1" ng-click="deleteNewImageRow(mulImage,$index);">

 </span>
</div>

 </div>

Here i am using ng-file-upload to upload the multiple image by plus button.When user will select the image from local drive the the images are displaying.But there is an additional case i have some image name i need to display those first and if user will select more it can be also possible.

 $scope.mulImage=[];
   $scope.mulImage.push({'image':null});
   $scope.addNewImageRow=function(mulImage){
       mulImage.push({'image':null});
   }
   $scope.deleteNewImageRow=function(mulImage,index){
       mulImage.splice(index,1);
       console.log('file',$scope.mulImage[0]['image'].name);
   }

The above is my controller side code.

var arr=["10lx18i3ciyhkt9_de021b24.jpg", "ajqgis4v1wi2j4i_a6d6c48a.jpg", "7pxknunjop9cnmi_silu nana.jpg"]      

Suppose i have the above images before.When the page will refresh the first 3 images will display to user like upload/10lx18i3ciyhkt9_de021b24.jpg and 3 image row also will create.if user wants to add/delete it can be also possible.Please help me.

2
  • So what the issue is here? Commented Apr 18, 2016 at 6:29
  • Kindly review this answer on this URL: stackoverflow.com/a/34505499/366884 Commented Nov 26, 2016 at 13:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.