One way to transfer data is by utilizing query parameters
this.http.post<any>('https://api.mysite.com/sources', [..body], [...header])
.subscribe(async res => {
const someData = res.data;
const url = res.url;
window.location.href = url + `?data1=${yourData1}&data2=${yourData2}`
})
Upon the arrival of the data in the other application, you can retrieve it as follows:
private readRedirectionData() {
const url = window.location.toString();
const data1 = this.getUrlParameter(url, 'data1');
const data2 = this.getUrlParameter(url, 'data2');
}
private getUrlParameter(url, name) {
if (!url) {
return '';
}
if (!name) {
return '';
}
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
const regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
const results = regex.exec(url);
return results === null ? '' : decodeURIComponent(results[1]);
}