简体   繁体   中英

How can i submit action link from Form using Angular 7?

How can achieve this in angular 7? how can submit this post action url in angular?

<form method="post" action="https://securegw- 
stage.paytm.in/order/process" name="paytm">
     <table border="1">
        <tbody>
           <input type="hidden" name="MID" value="YOUR_MID_HERE">
        </tbody>
     </table>
     <script type="text/javascript">
        document.paytm.submit();
     </script>
  </form>

Please help... thank you...

Can you try with selecting form in Component then call submit on nativeElement ?

@ViewChild('paytmForm', { read: ElementRef }) paytmForm: ElementRef; 

ngAfterContentInit() {
   this.paytmForm.nativeElement.submit()
}

In template add #paytmForm on form element

<form method="post" action="https://securegw- 
stage.paytm.in/order/process" name="paytm" #paytmForm >
...
</form>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM