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

查看:60
本文介绍了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 属性已记录.这将防止所有魔术"动作.有角度的行为,您将能够以本机方式提交表单(并重新加载页面).

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天全站免登陆