本文介紹了Ionic 2 無法解析 InAppBrowser 的所有參數的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我不明白為什么在使用本機 InAppBrowser 插件時出現以下錯誤:無法解析 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 ) {
};
}
推薦答案
你不需要將 InAppBrowser
添加到 providers 數組中,你也不需要在構造函數中注入它.
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');
}
這篇關于Ionic 2 無法解析 InAppBrowser 的所有參數的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!