Html 用一个简单的旧表单提交吗
我想在我的angular应用程序中完成一个简单的旧表单提交,例如,使用以下代码:Html 用一个简单的旧表单提交吗,html,angular,Html,Angular,我想在我的angular应用程序中完成一个简单的旧表单提交,例如,使用以下代码: <form method="post" action="http://other-server/"> <input name="something" value="somevalue"/> <button name="submit" type="sub
<form method="post" action="http://other-server/">
<input name="something"
value="somevalue"/>
<button name="submit" type="submit">Submit</button>
</form>
提交
所以我把它放在我的组件模板中,但当我按下按钮时,什么都没有提交
我想要这个的原因是http://other-server/ 不发送任何Access Control Allow Origin标头,因此我无法用javascript处理响应。MikeOne是正确的
将ngNoForm
添加到表单中
提交
您可以按如下方式执行:
<form #form action='http://other-server/' method='post'>
<input name="something"
value="somevalue"/>
<button type="submit" (click)="form.submit()">Submit</button>
</form>
提交
我认为您必须将ngNoForm添加到表单元素中。这样可以防止角度自动地将形状看作是一个角形。这很好,但是我必须使用提交按钮。我想你提交它的javascript。因此,我将其放入index.html中,并使用document.getElementbyID进行操作。因为它是一种隐藏的形式,所以没关系。