D
D
Dmitry Sokolov2016-07-06 17:24:27
Angular
Dmitry Sokolov, 2016-07-06 17:24:27

How to dynamically add file download buttons on click?

Good evening.
File selection button on the form.

<input type="file" name="file[]" multiple ng-files="getTheFiles($files)" />

If you make several of them, then everything works.
You need to add them dynamically.
I try to do like this:
<input ng-click = "addBtn()" class="mainform-btn-new" type="file" name="file[]" multiple ng-files="getTheFiles($files)" />
          <div ng-bind-html="newBtn"></div>

And in the controller:
$scope.newBtn = "<input ng-click = 'addBtn()' class='mainform-btn-new' type='file' name='file[]' multiple ng-files='getTheFiles($files)' />";

The problem is that the next button is added only 1 time and it is not working. The file can be selected, but it does not go away. Tell me what is my mistake and where to look for a solution.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Sokolov, 2016-07-06
@Dm-Sok

Found the solution www.shanidkv.com/blog/angularjs-adding-form-fields...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question