Angular 5 simple form with Action is not working Angular 5 simple form with Action is not working angular angular

Angular 5 simple form with Action is not working


You can do it in following way:

<form #form action='https://easypaystg.easypaisa.com.pk/easypay/Index.jsf' method='post'>    ...    <button type="submit" class="btn btn-success" (click)="form.submit()">Submit</button>    ...</form>


Posting a form directly causes a page reload, that's usually not what you want in an Angular application (SPA). Grab the data from the form and send an HTTP request from your code to the server instead.

You should leverage the NgSubmit directive, as described here


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).

So something similar to:

<form ngNoForm action='https://easypaystg.easypaisa.com.pk/easypay/Index.jsf' method='post'>    <input  name='storeId' value='4950'>    ...    <input type='submit' value='asdasd' class="btn"></form>