Ionic 2 Can't resolve all parameters for InAppBrowser

I don't understand why I get the following error when I use the native InAppBrowser plugin : Can't resolve all parameters for InAppBrowser

import { Component } from '@angular/core';
import { NavController, NavParams, Platform } from 'ionic-angular';
import { InAppBrowser } from 'ionic-native';

@Component({
  selector: 'page-sign-in',
  templateUrl: 'sign-in.html',
  providers: [ InAppBrowser ]
})
export class SignInPage {

  constructor(public navCtrl: NavController, public platform: Platform, public inAppBrowser: InAppBrowser ) {


  };

}

Answers:

Answer

You don't need to add InAppBrowser to the providers array and you also don't need to inject it in the constructor.

Simply import it in the beginning of the page (as you did), and then use it anywhere in the code like that:

openPage() {
  new InAppBrowser('https://google.com', '_system');
}

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.