【问题标题】:Ionic 2 Can't resolve all parameters for InAppBrowserIonic 2 无法解析 InAppBrowser 的所有参数
【发布时间】:2017-01-19 23:22:48
【问题描述】:

我不明白为什么在使用本机 InAppBrowser 插件时出现以下错误:无法解析 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 ) {


  };

}

【问题讨论】:

    标签: javascript angular typescript ionic2


    【解决方案1】:

    您无需将InAppBrowser 添加到 providers 数组中,也无需将其注入到构造函数中。

    只需在页面开头导入它(就像您所做的那样),然后在代码中的任何位置使用它:

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

    【讨论】:

      猜你喜欢
      • 2017-11-28
      • 1970-01-01
      • 2017-10-05
      • 1970-01-01
      • 1970-01-01
      • 2017-08-12
      • 2017-04-24
      • 2016-11-08
      • 2017-11-06
      相关资源
      最近更新 更多