Upload multiple files in angular

前端 未结 3 1553
情书的邮戳
情书的邮戳 2020-12-05 13:35

I\'ve a situation where I\'ve a form in which I\'ve a row where I\'ve two text fields entries and I\'ve to upload a file for that row and this kind of rows can be \'N\' and

3条回答
  •  时光说笑
    2020-12-05 14:03

    from saltuk's answer above there is a small change for the code to work

        var modelSetter = model.assign;
            element.bind('change', function () {
                var values = [];
                angular.forEach(element[0].files, function (item) {
                    var value = {...
                    }
                }
            }
    

    the array var should be defined above before forEach function

        var modelSetter = model.assign;
        element.bind('change', function () {
            var values = [];
            angular.forEach(element[0].files, function (item) {
                var value = {...
                }
            }
        }
    

提交回复
热议问题