I have 2 pages in angular, page1 with a button, when clicked, it opens page2.
So they are 2 different components. I must use window.opener to get page1 data in page2 because i am calling window.opener.page1Func()
In pure html and javascript, i can get data from page1func defined in page1.
page1
function page1func()
{
return "xxx";
}
page2
var result = window.opener.page1func();
above is working fine in pure js and html, but how can i do this in Angular way? (angular 8 is what i am using)
Any clue would be helpful. Thanks.
There are multiple ways to pass data from parent to child (pop up new window)
Defining "window" component that will be rendered on a new popup window .Here is a working example of popup window component
ngrx-store
window.postMessage()
session/local storage