Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular forms module disables a previously working form

Tags:

forms

angular

This happens inside my angular 5 app:

I have this form, which works well:

<form name="pdfForm" method="post" [action]="pdfUrl" target="_blank">
  <input type="hidden" name="data" [value]="data">
  <button type="submit">
    Download as Pdf
  </button>
</form>

When I add the Forms Module to the application (which I need for another form) however, the above form stops working!

Does anyone know why? And what can I do about it?

like image 241
Jan van Casteren Avatar asked Jun 17 '26 08:06

Jan van Casteren


1 Answers

I found the answer myself. Angular seems to provide a ngNoForm directive | attribute (?), although you won't find it in the docs (which is stupid by the way).

I added it to my plunk, and it works now:

<form ngNoForm name="pdfForm" method="post" action="/goanywhere" 
    target="_blank">
    <input type="hidden" name="data" value="mydata">
    <button type="submit">
      Download as Pdf
    </button
</form>

https://plnkr.co/edit/0HULN4jvTicnmscK7D0o?p=preview

like image 81
Jan van Casteren Avatar answered Jun 18 '26 21:06

Jan van Casteren