上传新图像时,现有图像会从轮播中消失

时间:2016-03-06 14:25:31

标签: css angularjs ng-file-upload

为什么上传新图像时会删除ng模型图像(数据)?旋转木马失去了'所有的照片和节目都没有。

上传按钮:

<button style="text-align:center; margin-left: 50%; transform:translateX(-50%); margin-top: 40px; color: 2d5d82" 
      ngf-select="" 
      class="btn btn-lg"
      ng-model="$parent.files" 
      ng-model-rejected="rejFiles" 
      ngf-drag-over-class="{accept:'dragover', reject:'dragover-err', delay:100}" 
      ngf-multiple="true" 
      ngf-resize="{width: 400, height: 250, centerCrop: true}"
      ngf-validate="{size: {max: '20MB', min: '10B'}, height: {max: 12000}, width: {max: 12000}}"
      ngf-allow-dir="true" 
      ngf-keep="true"
      ngf-accept="'image/*,application/pdf'" 
      ngf-drop-available="dropAvailable" 
      ngf-capture="camera"  
      Click here to upload pictures 
</button>

主图像轮播:

<div>
    <uib-carousel  no-wrap="WrapSlides" style="max-height: 330px;">
          <uib-slide ng-repeat="slide in files" id="carousel-custom" active="slide.active" style="width:80%; max-height: 300px;">
               <img ng-src="{{slide.image_path}}" style="margin:0px; max-height: 300px;  width:auto; height: auto; margin-left: 50%; transform: translateX(-50%); z-index: 0;" >
               <img style="margin-left: 50%; transform:translateX(-50%); top:0px;  width: 25px; cursor:pointer; z-index: 50;" ng-click="delete_image(slide)" ng-src="{{image.src.del_image}}">
           </uib-slide>
    </uib-carousel>
</div>

旋转木马的位图:

<td ng-repeat='slide in count = (files) track by $index' data-target='#carousel-custom' ng-click="update_carousel($index)" style="min-height:60px; max-height: 60px; height:60px !important; width:auto; display:inline-block; padding:0px; margin: 0px; " ng-class="{ active: isActive(slide) }" class="ng-scope">
     <img ng-src="{{slide.image_path}}" alt='' style="width:auto; min-height:60px; max-height: 60px; height:60px !important; cursor:pointer; display:inline-block; margin-left:2px; margin-right:2px; "/>
</td>

上传新图片时模型中所有变化都会激活,会被添加到图像数组中:

...,{"active":false}]

0 个答案:

没有答案