JSFiddle - React, Tailwind, and code Playground

by Serhioromano

HTML

<div ng-app ng-controller="TestController">
    <div ng-repeat="item in form.files">
        <label>File {{$index+1}}:</label>
        <input ng-model="item[$index]" type="file"/>
    </div>
    <br><br>
    <button ng-click="add()">Add field</button>
    <button ng-click="save()">Save</button>
</div>

JavaScript

function TestController($scope) {
    $scope.form = {
        files: []
    }
    
    $scope.add = function() {
        $scope.form.files.push(1);
    }
    
    $scope.save = function() {
        alert(angular.toJson($scope.form));
    }
}