下面的代碼組合更清潔的方式工作傳遞一個文件輸入的文件與angular.js
$scope.onFileSelect = function(element) {
alert("selam");
console.log(element.files);
};
<input type="file" class="file" ng-model="filefoo" multiple onchange="angular.element(this).scope().onFileSelect(this)"/>
但爲什麼我必須寫很長的表達式:angular.element(this).scope().onFileSelect(this)
我怎麼能寫清潔也許像
<input type="file" class="file" ng-model="filefoo" multiple onchange="onFileSelect(this)"/>
你的意思是,無論我做什麼甚至可能與http://blueimp.github.io/jQuery-File-Upload/angularjs.html,我不能做一些像$ scope。$ on(「fileuploadchange」,函數(e,data){data.files ...我正確嗎?::清理一些東西,我需要一個指令,如果已經有一個指令在宇宙中,你可能知道它?謝謝你的明確答案 – merveotesi
對不起,我沒有知道bluimp - 也許tehy已經以一種有角度的方式解決了這個問題,「宇宙中的一個指令」從來沒有用過這樣的指令,一個不需要這樣的指令使用mutch代碼,並且有一個角度爲1.3的特徵請求。 .. – michael
非常感謝您的回覆。我認爲我的指令不會很乾淨,所以我想問你是否知道這個問題,如果你有建議,那麼,我已經學會了blueimp有一個角度指令。讓它運行我的應用程序。提前致謝。 – merveotesi