0

I want something like that Example 1 and Example 2. I create a ionic project and create a .html file. Then open that file in pages/home.ts file inside iframe.

pages/home.ts

import { DomSanitizer } from '@angular/platform-browser';

my_url: any;

constructor(private sanitize: DomSanitizer) {
}

urlpaste(){
this.my_url = "assets/imgs/ankur.html";
return this.sanitize.bypassSecurityTrustResourceUrl(this.my_url);
}

pass_to_ankur(){
//how to pass any text in ankur.html file with this function
}

pages/home.html

<ion-content>

<iframe height="100%"  width="100%" [src]="urlpaste()"></iframe>

</ion-content>


<ion-footer>
 <ion-toolbar (click)="pass_to_ankur()">
  <ion-title>Pass variable</ion-title>
 </ion-toolbar>
</ion-footer>

And my ankur.html file path inside ionic project "assets/imgs/ankur.html". I want I press "pass variable" footer and value pass in ankur.html file. How it possible. I see many examples but maximum android native to html page connectivity. But i want in ionic project.

ankur.html

<!DOCTYPE html>
<html>
 <body>
  <h1>My First Heading</h1>
  <p>My first paragraph.</p>
 </body>
 <script type="text/javascript">
  alert("call==");
 </script>
</html>

Please help because I try to many days but not given any solution. :( Please understand my problem and resolve my issue. Sorry for my weak english. ThankYou

Thum Choon Tat
  • 3,084
  • 1
  • 22
  • 24

0 Answers0