我正在尝试实现一个自定义模板,以允许选择要上传的图像。用户选择图像后,该图像将显示在表单上的水平滚动条中。model字段是所选图像文件名的数组。
该功能在正常形式下工作得很好,但当转换为Angular-Formly时,图像选择过程可以工作,模型字段(数组)会更新,但NG-REPEAT (水平滚动条)不会显示数组中的图像。
我想要实现的模板是:
<!-- IMAGE HORIZONTAL SCROLLER AND INPUT -->
<script type="text/ng-template" id="imagePicker.html">
<ion-item class="item-icon-right">
<i class="icon ion-images" ng-click="to.onclick(model,options)"></i>
<ion-scroll direction="x" style="height:200px; min-height: 200px; overflow: scroll; white-space: nowrap;">
<img ng-repeat="image in model[options.key]" ng-src="{{urlForImage(image)}}" style="height:100px; padding: 5px 5px 5px 5px;"/>
</ion-scroll>
</ion-item>
</script>
<!-- END OF IMAGE HORIZONTAL SCROLLER AND INPUT -->发布于 2016-05-09 01:52:50
这是我自己解决的。问题是
ng-src="{{urlForImage(image)}}"由于某种原因,电话无法接通。因此,我在将值存储在数组中时调用此方法,并将其更改为
ng-src="{{ image }}"现在它起作用了。
https://stackoverflow.com/questions/37096952
复制相似问题