I am trying to use postmessage to have an embedded iframe in my app, communicate with the content on my server that is being embedded. To do this I need to be able to access the .contentWindow of the iframe element and the iframe is in a modal and I need to be able to access it from anywhere in my app.
I have a couple of questions:
I know it is not good practice to access the DOM directly, is there any way to access the iframe’s contentWindow without accessing the DOM directly?
In Ionic v1 I was able to access the contentWindow of the iframe by simply using document.getElementById(‘name_of_iframe_element’).contentWindow. This doesnt work in V2. I know I can use ViewChild to access an element in the same page, but how do I do this to get an element on a different page?
Thanks for the help.