Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 用一个简单的旧表单提交吗_Html_Angular - Fatal编程技术网

Html 用一个简单的旧表单提交吗

Html 用一个简单的旧表单提交吗,html,angular,Html,Angular,我想在我的angular应用程序中完成一个简单的旧表单提交,例如,使用以下代码: <form method="post" action="http://other-server/"> <input name="something" value="somevalue"/> <button name="submit" type="sub

我想在我的angular应用程序中完成一个简单的旧表单提交,例如,使用以下代码:

<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进行操作。因为它是一种隐藏的形式,所以没关系。