Putting a web site inside an Ionic app

1

I'm working with Ionic 3, what I'm trying to do is put a web site in an Ionic app.

I have it resolved but in the home.html I have a button which calls a blank page and puts it there, what I need is that when you open the application you can see the web without an intermediary button.

I show the code that I occupy.

Home.html

<ion-header>


 <ion-navbar>
    <ion-title>
      <!-- Ionic Blank -->
    </ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding>
  <button ion-button color="primary" (click)="openLink()">Abrir link</button>
</ion-content>

Home.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { InAppBrowser } from '@ionic-native/in-app-browser';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
  // template:"<p>...loading</p>"
})
export class HomePage {

  constructor(public navCtrl: NavController, private iap: InAppBrowser) {

    }
    openLink(){
      this.iap.create("https://www.ubikate.net/","_blank");
  }
  // constructor(private iab: InAppBrowser, public platform: Platform){
  //   platform.ready().then(()=>{
  //     let browser = this.iab.create('https://www.ubikate.net/');
  //     browser.show();
  //   });
  // }
}

How should I modify to achieve what I want?

Greetings!

    
asked by Pedro Ávila 12.07.2018 в 21:22
source

1 answer

1

You could try the next segment of code, I do not have the environment available for testing but maybe it can serve you from my point of view:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { InAppBrowser } from '@ionic-native/in-app-browser';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
  // template:"<p>...loading</p>"
})
export class HomePage {

  constructor(public navCtrl: NavController, private iap: InAppBrowser) 
  {

  }
  ionViewDidLoad() 
  {
      this.iap.create("https://www.ubikate.net/","_blank")
  }
}

As I told you in the comment, you only have to use the event ionViewDidLoad , let me know if it works but also hehe

    
answered by 12.07.2018 в 22:57