Angular 5 默认表单提交 [英] Angular 5 default form submit

查看:25
本文介绍了Angular 5 默认表单提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,有没有办法执行默认提交连接到表单模型的表单?.

Hello is there a way to perform default submit a form connected to the Form Model?.

  <form action="http://someaction.com" [formGroup]="SendForm" method="POST">
    <input name="currency" formControlName="sendCurrency">
    <input name="amount" formControlName="sendPrice">

    <fieldset *ngFor="let item of SendData; let i = index">
        <input name="vouchers[{{i}}][quantity]" value="{{item.count}}">
        <input name="vouchers[{{i}}][ean]" value="{{item.code}}">
    </fieldset>

    <input type="submit" value="submit">

  </form>

** 更新 **我需要实现完全类似于下面的形式的行为.因此,在使用 POST 数据提交重定向用户之后.

** Update ** I need to achive a behavior extactly like form below. So after submit redirecting user with POST data.

<form action="http://someurl.com" method="POST" >
   <input type="submit" value="asd">
</form>

推荐答案

使用 ngNoForm 属性 如文档所示.这将阻止所有魔法"Angular 行为,您将能够以本机方式提交表单(页面重新加载).

Use the ngNoForm attribute as documented. This will prevent all "magic" Angular behavior, and you will be able to submit the form in the native way (with page reload).

所以类似于:

<form ngNoForm action="http://someurl.com" method="POST" >
   <input type="submit" value="asd">
</form>

这篇关于Angular 5 默认表单提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆