emillamm
emillamm

Reputation: 139

Nesting HTML form alternative

I am trying to add an upload module (ngUpload) to my code. The problem is that ngUpload uses a HTML form and I need to place it within another HTML form for a layout purpose. This is what my setup looks like:

<form name="form" novalidate>
<div class="form-group addscript">
...
    <form ng-upload="uploader(content)" method="post" action="/upload" name="foo" enctype="multipart/form-data">
      <p class="help-block"><input type="file" name="file"></p>
      <a href='javascript:void(0)' class="upload-submit" ng-click="saveData()">Upload</a> 
    </form>
...
</div>
</form>

And I know that I can't nest HTML forms, so what is the easiest way to solve this? Maybe there is a way to "inject" the upload form to the outer form, without violating the nesting forms concept?

Upvotes: 1

Views: 151

Answers (1)

karaxuna
karaxuna

Reputation: 26930

In angularjs you CAN nest forms like this:

<form name="form1">
    <div ng-form="" name="form2">
    </form>
</form>

ngForm acts exactly like actual form

Upvotes: 1

Related Questions