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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容