title: How to open a new tab with a post request from a component in Angular
body: <p>I am trying to build a function which sends a request post to a url, and at the same time open that url in a new tab with the post request...</p>
  <p>This is what i got so far...</p>
  <p><strong>OLD</strong></p>
  <pre><code>pay() {
      var data = `{
        &quot;description&quot;: &quot;Test PAYU&quot;,
        &quot;referenceCode&quot;: &quot;TestPayU&quot;,
        &quot;amount&quot;: &quot;20000&quot;,
        &quot;tax&quot;: &quot;3193&quot;,
        &quot;buyerEmail&quot;: &quot;test@test.com&quot;,
        &quot;responseUrl&quot;: &quot;http://www.test.com/response&quot;,
        &quot;confirmationUrl&quot;: &quot;http://www.test.com/confirmation&quot;,
        &quot;submit&quot;: &quot;&quot;
      }`;
      this.http.post('https://sandbox.checkout.payulatam.com/ppp-web-gateway-payu/', data).subscribe( (response)=&gt;{
        console.log(response);
       });
    }
  </code></pre>
  <p>I want to open that url in a new tab within the request post on it..</p>
  <p>I don't know how to do that with Angular...</p>
  <p><strong>UPDATE</strong></p>
  <p>So, I have done this solution for this problem, adding this dynamic form with javascript to do that:</p>
  <pre><code>pay() {
      var form = document.createElement(&quot;form&quot;);
      form.setAttribute(&quot;method&quot;, &quot;post&quot;);
      form.setAttribute(&quot;action&quot;, &quot;https://sandbox.checkout.payulatam.com/ppp-web-gateway-payu&quot;);
      form.setAttribute(&quot;target&quot;, &quot;view&quot;);
      var hiddenField = document.createElement(&quot;input&quot;);
      hiddenField.setAttribute(&quot;type&quot;, &quot;hidden&quot;);
      hiddenField.setAttribute(&quot;merchantId&quot;, &quot;508029&quot;);
      hiddenField.setAttribute(&quot;accountId&quot;, &quot;512321&quot;);
      hiddenField.setAttribute(&quot;description&quot;, &quot;Test PAYU&quot;);
      hiddenField.setAttribute(&quot;referenceCode&quot;, &quot;TestPayU&quot;);
      hiddenField.setAttribute(&quot;amount&quot;, &quot;20000&quot;);
      hiddenField.setAttribute(&quot;tax&quot;, &quot;3193&quot;);
      hiddenField.setAttribute(&quot;taxReturnBase&quot;, &quot;16806&quot;);
      hiddenField.setAttribute(&quot;currency&quot;, &quot;COP&quot;);
      hiddenField.setAttribute(&quot;signature&quot;, &quot;7ee7cf808ce6a39b17481c54f2c57acc&quot;);
      hiddenField.setAttribute(&quot;test&quot;, &quot;1&quot;);
      hiddenField.setAttribute(&quot;buyerEmail&quot;, &quot;test@test.com&quot;);
      hiddenField.setAttribute(&quot;responseUrl&quot;, &quot;http://www.test.com/response&quot;);
      hiddenField.setAttribute(&quot;confirmationUrl&quot;, &quot;http://www.test.com/confirmation&quot;);
      hiddenField.setAttribute(&quot;submit&quot;, &quot;&quot;);
      form.appendChild(hiddenField);
      document.body.appendChild(form);
      window.open('', 'view');
      form.submit();
  }
  </code></pre>
  <p>The problem is, even if the page is opened in a new tab, the parameters are not sent to the page...</p>
  <p>What could be the problem?</p>