title: Calling a function from iFrame in TypeScript
body: <p>I am using Angular 5, and fairly new to TypeScript and Angular. I know how to call a function from regular button from my x.component.html after clicking, but, couldn't find how to call a function from iFrame.</p>
  
  <p><strong>My component.html code :-</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;iframe id="myIframe" src="{{getSanURL()}}" name="targetframe" height="100%" allowTransparency="true" width="100%" scrolling="yes" frameborder="0" &gt;
     
   &lt;/iframe&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>My component.ts code :-</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public getSanURL()
      {      
       var nd = new Date(); 
       var Day = nd.getUTCDate();
       var Month = nd.getUTCMonth()+1;
       
       var str = new String(currentUTCYear);
      
       var DM = Day.toString()+Month.toString();
       console.log(DM);
       
       var dynamicSanURL = "https://somelink"+DM+".someaddress/Some.html"; 
    
       return dynamicSanURL;
     }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Took help from this but in vain - <a href="https://stackoverflow.com/questions/17229245/javascript-function-in-iframe-src">JavaScript function in iframe src</a></p>
  
  <p>I want this dynamicSanURL to be returned in iFrame. I don't know where I am going wrong.</p>