Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. import { Platform, NavController } from 'ionic-angular';
  2. import { Component } from '@angular/core';
  3. import { ServicesProvider } from '../../providers/services/services';
  4.  
  5. let win: any = window;
  6.  
  7. @Component({
  8. selector: 'page-home',
  9. templateUrl: 'home.html'
  10. })
  11. export class HomePage {
  12. url: string = "";
  13.  
  14. constructor(public platform: Platform, public navCtrl: NavController, public Services: ServicesProvider) {
  15. this.platform.ready().then(() => {
  16. if(this.platform.is('cordova')) {
  17. this.url = this.Services.getStorageDirectory();
  18. this.url = win.Ionic.WebView.convertFileSrc(this.url) + "/index.html";
  19. }
  20. })
  21. }
  22. }
  23.  
  24. <iframe [src]="url | safe" name="trustResourceURL" frameborder="0" scrolling="no" onload="this.style.visibility='visible';"></iframe>
  25.  
  26. import { Pipe, PipeTransform } from '@angular/core';
  27. import { DomSanitizer } from '@angular/platform-browser';
  28.  
  29. @Pipe({
  30. name: 'safe',
  31. })
  32. export class SafePipe implements PipeTransform {
  33. constructor(private sanitizer: DomSanitizer) {}
  34. transform(url) {
  35. return this.sanitizer.bypassSecurityTrustResourceUrl(url);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement