Javascript 角度文件模型在ng repeat中不工作

Javascript 角度文件模型在ng repeat中不工作,javascript,angularjs,Javascript,Angularjs,我的指示如下 angularApp.directive('fileModel', ['$parse','flash', function ($parse, flash) { return { restrict: 'A', link: function (scope, element, attrs) { var model = $parse(attrs.fileModel); var modelSetter = model.assign;

我的指示如下

      angularApp.directive('fileModel', ['$parse','flash', function ($parse, flash) {
return {
    restrict: 'A',
    link: function (scope, element, attrs) {
        var model = $parse(attrs.fileModel);
        var modelSetter = model.assign;

        element.bind('change', function () {
            console.log(scope.tools);
            if (element[0].files[0].size <= 4000000) {

                if (attrs.fileType != 'image' || element[0].files[0].type == "image/jpg" || element[0].files[0].type == "image/jpeg" || element[0].files[0].type == "image/png" || element[0].files[0].type == "image/gif" || element[0].files[0].type == "image/bmp") {
                    scope.$apply(function () {
                        modelSetter(scope, element[0].files[0]);
                    });
                }
                else {                        
                    flash.pop({
                        title: 'Warning',
                        body: 'Please select logo of type jpg,png,gif or bmp',
                        type: 'warning'
                    });
                }


            }
            else {
                flash.pop({
                    title: 'Warning',
                    body: 'Please select max 4 MB in size',
                    type: 'warning'
                });
            }               
        });
    }
};
}]);
angularApp.directive('fileModel',['$parse','flash',function($parse,flash){
返回{
限制:“A”,
链接:函数(范围、元素、属性){
var model=$parse(attrs.fileModel);
var modelSetter=model.assign;
元素绑定('change',函数(){
console.log(scope.tools);

如果(元素[0].files[0].size,您可以只设置file model=“casestudy”我看这个方法没有问题-据我所知应该可以工作。您可以发布一个提琴吗?@Nitu Bansal file model=”“属性后的逗号是什么?我将tools.casestudies[$index].FileName放在文件模型中,现在可以了!!
   <div class="form-group browse-file" ng-repeat="casestudy in tools.casestudies">
                            <input type="file" file-model="tools.casestudies[$index]", file-type="doc" class="col-lg-4 browse-file-info" />
                        </div>