title: Cannot read property 'contentWindow' of null - iframe in ionic menu
body: <p>Here is my plunker:</p>
  
  <p><a href="http://plnkr.co/edit/8SOkJeAG4Tctp4zLoAJ0?p=preview" rel="nofollow">http://plnkr.co/edit/8SOkJeAG4Tctp4zLoAJ0?p=preview</a></p>
  
  <pre><code>var iframe = document.getElementById('myIframe');
  var iframediv = iframe.contentWindow.document;      // canvas goes here
  iframediv.body.innerHTML += '&lt;canvas id="stage" width="360" height="180"&gt;&lt;/canvas&gt;';
  </code></pre>
  
  <p>Is the code where I am getting the cannot read property error.</p>
  
  <p>I'm attempting to create a canvas in an iframe, the iframe is located on a page which is loaded as an ionic menu.</p>
  
  <p>I want the code which controls the data in the canvas to be contained in a separate js file for easy readability and re-use the code if required.</p>
  
  <p>The problem seems to be that since I'm declaring my JavaScript file in my index.html, but the iframe I want to use is in my home.html file then the JavaScript file can't find it?</p>
  
  <p>How should I declare my iframe and javascript files so that it can read the properties of my iframe in a nested javascript file?</p>