简体   繁体   English

是否可以使用Angular.js更改文件类型输入的默认占位符值

[英]Is it possible to change the default placeholder value of file type input using Angular.js

I am facing one issue. 我正面临一个问题。 Is this possible to change the file type input default text ie-No file choosen and set the custom placeholder value. 是否可以更改输入默认文本的文件类型, ie-No file choosen并设置自定义占位符值。 Actually i need to set the custom placeholder value inside the file type input. 实际上,我需要在文件类型输入中设置自定义占位符值。 I am explaining my code below. 我在下面解释我的代码。

<div class="row">
    <div class="col-md-12">
        <div style="margin-bottom: 25px" class="input-group">
            <span class="input-group-addon"><i class="fa fa-upload"></i></span>
            <input type="file" class="filestyle form-control" data-size="lg" name="upload" id="bannerimage"  ng-model="file" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="2MB" ngf-select="onFileSelect($file);">
        </div>
    </div>
</div>

Here I need to change that default text No file choosen to Add driving Licence . 在这里,我需要更改默认文本,即“未No file choosenAdd driving Licence

You cannot change the default labels No file choosen on buttons, they are hard-coded in browsers 您无法更改默认标签按钮上No file choosen ,它们在浏览器中是硬编码的

Using label you can assign custom text, hide the input element and add label for file input element, 使用标签,您可以分配自定义文本,隐藏输入元素并为文件输入元素添加标签,

<input type="file" id="file" class="filestyle form-control hidden" data-size="lg" name="upload" id="bannerimage"  ng-model="file" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="2MB" ngf-select="onFileSelect($file);" >
<label for="file">{{fileInputPlaceHolder}}</label>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM