Reputation: 909
I am a backend developer, trying to work on angular I am trying to open a popup(window.open) with a form submit to an external application from angular. "window.open" its submitting request but not the form. This popup is a common popup (existing application) from other applications. those are existing applications.
HtmlIn the HTML page set the form as hidden.
<header>
...
<ul>
<li>
<a href="#" (click)="contactSupportPopUP()">Contact Support</a>
</li>
....
</ul>
...
<form [formGroup]="contactSupportForm" action="url" method="post" traget="openSupportPopup">
<input type="hidden" formControlName="appId" id="appId" value="App1">
<input type="hidden" formControlName="appNm" id="appNm" value="AppOne">
....
....
</form>
</header>
Component.ts
supportForm: FormGroup; externalAppUrl:string="http://....";
constructor(formBuilder: FormBuilder...)// added formBuilder, formsModule, ReactiveFormModules
{
this.supportForm= new FormGroup({
appId: new FormControl('App1'),
appNm: new FormControl('AppOne'),
.....
}
public contactSupportPopUP(){
window.open(this.externalAppUrl);//This open not submitting form
window.open(this.externalAppUrl+'?appId=App1'&appNm=AppOne&...);//This is working. Dont want tosubmit data in url param.
}
I am not sure how to submit a form to an external app.
one of the existing application has hidden form in JSP, they are able to submit javascript.
Upvotes: 0
Views: 184
Reputation: 479
If you need to open url in your existing application, you can use an iframe
.
And, to post form data you use this.supportForm.value
as postData
in http post request through angular.
Upvotes: 1