title: Receive POST data inside angular component
body: <p>I am integrating Payment gateway in Angular version 7. </p>
  
  <p>Payment gateway needs data input like below </p>
  
  <pre><code>requestParameter : MerchantId||CollaboratorID||Encrypted_string
  </code></pre>
  
  <p>I tried to submit form using ngForm as below, but my request is not posting to Payment gateway url and getting error 404 not found for "<a href="http://localhost:4200/direcPayment/" rel="nofollow noreferrer">http://localhost:4200/direcPayment/</a>" and Session expired message of Payment gateway in a response of that. It's just like if anything is wrong in the request you get session expired message. </p>
  
  <pre><code>&lt;form  (ngSubmit)="onSubmit()" method="POST" mt-3&gt;
  </code></pre>
  
  <p>Behind in the code, I am passing the parameter as required and making http.post call as below. On click of OnSubmit I have called formSubmit with encrypted string</p>
  
  <pre><code>formSubmit( encryptedString) {
  const formData = new FormData();
  formData.append( 'requestParameter', encryptedString);
  
  this.http.post('direcPayment/', formData, httpFormDataOptions)
      .subscribe((resposne) =&gt; {
        console.log(resposne);
      });
  </code></pre>
  
  <p>}</p>
  
  <p>Inside "httpFormDataOptions" I have added below headers</p>
  
  <pre><code>const httpFormDataOptions = {
    headers: new HttpHeaders(),
  };
  httpFormDataOptions.headers.append('Access-Control-Allow-Origin', '*');
  httpFormDataOptions.headers.append('Access-Control-Allow-Methods', 'DELETE, POST, GET, OPTIONS');
  httpFormDataOptions.headers.append('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With');
  </code></pre>
  
  <p>/direcPayment refers to my Proxy.config.json file as below</p>
  
  <pre><code>{
    "/direcPayment": {
    "target": "PaymentGatewayURL",
    "secure": true,
    "pathRewrite": {"^/direcPayment" : ""},
    "changeOrigin": true
    },
  }
  </code></pre>
  
  <p>so currently I used ngNoForm and submit the form using action attribute.</p>
  
  <p>So I want to ask two queries</p>
  
  <ol>
  <li><p>Submitting form to payment gateway link using httpClient POST method</p></li>
  <li><p>Payment Gateway says, if payment is either successful/failure then they will redirect to success/failure URL as POST data in encrypted format, So how to receive data to a specific URL in angular? Is there any way to receive data if someone called my angular URL in both cases either using httpClient Call OR ngNoForm</p></li>
  </ol>
  
  <p>Thanks.</p>