Reputation: 1985
I want to do a plain old form submit within my angular app, e.g. with this code:
<form method="post" action="http://other-server/">
<input name="something"
value="somevalue"/>
<button name="submit" type="submit">Submit</button>
</form>
So I put this into my components template, but nothing is submitted when I push the button.
The reason why I want this is because http://other-server/ does not send any Access-Control-Allow-Origin headers, so I cannot process the response in javascript.
Upvotes: 2
Views: 858
Reputation: 18974
You can do it like below:
<form #form action='http://other-server/' method='post'>
<input name="something"
value="somevalue"/>
<button type="submit" (click)="form.submit()">Submit</button>
</form>
Upvotes: 0
Reputation: 6896
MikeOne is correct.
Add ngNoForm
to your form
<form ngNoForm method="post" action="http://other-server/">
<input name="something"
value="somevalue"/>
<button name="submit" type="submit">Submit</button>
</form>
Upvotes: 5