doudiyu1639 2015-12-10 10:41
浏览 34

如何使用Angular.js和php在编辑案例中设置图像标签中的文件

I need one help.I have my file/image path in my DB.When i needed to update i retrieved that path and wanted to set in that image/file tag for display.I am explaining my code below.

 <div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Upload Image :</span>
 <input type="file" class="filestyle form-control" data-size="lg" name="uploadme" id="bannerimage"  ng-model="file" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="20MB" ngf-min-height="100" ngf-resize="{width: 100, height: 100}" custom-on-change="uploadFile" required="required" ngf-select="onFileSelect($file);" ng-readonly="imageread" ng-disabled="imagedis">
</div>
<div class="input-group bmargindiv1 text-right col-md-12" ng-show="showImage">
<img ng-src="{{attchImage}}" name="pro" border="0" style="width:50px; height:50px; border:#808080 1px solid;" />
</div>

The part is my HTML part of Image tag.My controller side code is given below.

$scope.showImage=true;
$scope.attchImage="upload/"+response.data[0].image;

Here i am setting the image name with path for display purpose. But i have below common validation for both add and update case.

if(billdata.uploadme.$invalid){
    alert('Please select the proper image');
    productInpuFieldFocus.borderColor('bannerimage');
}

Here my problem is even if its not mandatory to update image again in update case still it is showing the validation error message. But here i need in Add case this error will be checked and in update it will not check so i need to add that file name in image tag and file input tag.Please help me.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 路易威登官网 里边的参数逆向
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程
    • ¥20 模型在y分布之外的数据上预测能力不好如何解决
    • ¥15 processing提取音乐节奏