我已經看到很多關於風格輸入類型文件的問題,但我無法找到它做的角度。角度如何風格輸入類型文件
那麼如何在一個角度的應用程序裏面輸入一個輸入文件?
這是我的代碼中和HTML頁面:
<input type="file" ngf-select ng-model="vm.attachment" name="file" accept="application/pdf" ngf-max-size="5MB" ngf-model-invalid="errorFile">
我已經與(我的輸入文件hidde後)嘗試:
<md-button id="uploadButton" class="md-raised md-primary"> Choose Files </md-button>
link (scope, element, attrs) {
const input = element.find('#fileInput');
const button = element.find('#uploadButton');
if (input.length && button.length) {
button.click((e) => input.click());
}
}
但它不工作,我的鏈接功能不起作用,因爲我使用控制器,並在頁面內檢索錯誤,如果我把這個功能
您可以使用'NGF-select'指令上的按鈕,例如,從GitHub的文檔頁面http://jsfiddle.net/檢查例子danialfarid/xxo3sk41/590/ '<按鈕NGF選NG-模型= 「picFile」 接受= 「圖像/ *」> 選擇圖片' – Fissio
似乎作品!發表一個答案,我接受它 –
我不能做的唯一事情是當我選擇一個文件我想看到文件的名稱,是否可能? @Fissio –