离子2主题浏览器错误“" [英] ionic 2 themeable browser error ""
问题描述
我做的事情:
安装了该插件。在这里我的app / app.component的代码:
installed the plugin. Ans here my code for app/app.component :
从'@ ionic-native / themeable-browser导入{ThemeableBrowser,ThemeableBrowserOptions,ThemeableBrowserObject} ';
app / app.module.ts:
import {ThemeableBrowser,ThemeableBrowserOptions,ThemeableBrowserObject}来自'@ ionic-native / themeable-browser';
app/app.module.ts :
import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';
providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}ThemeableBrowser]
我的约.ts:
import { ThemeableBrowser } from 'ionic-native';
open() {
const options: ThemeableBrowserOptions = {
statusbar: {
color: '#ffffffff'
},
toolbar: {
height: 44,
color: '#f0f0f0ff'
},
title: {
color: '#003264ff',
showPageTitle: true
},
backButton: {
image: 'back',
imagePressed: 'back_pressed',
align: 'left',
event: 'backPressed'
},
forwardButton: {
image: 'forward',
imagePressed: 'forward_pressed',
align: 'left',
event: 'forwardPressed'
},
closeButton: {
image: 'close',
imagePressed: 'close_pressed',
align: 'left',
event: 'closePressed'
},
customButtons: [
{
image: 'share',
imagePressed: 'share_pressed',
align: 'right',
event: 'sharePressed'
}
],
menu: {
image: 'menu',
imagePressed: 'menu_pressed',
title: 'Test',
cancel: 'Cancel',
align: 'right',
items: [
{
event: 'helloPressed',
label: 'Hello World!'
},
{
event: 'testPressed',
label: 'Test!'
}
]
},
backButtonCanClose: true
};
const browser: ThemeableBrowserObject = this.themeableBrowser.create('https://ionic.io', '_self', options);
}
我的html:
<button ion-button icon-only (click)="open()">
<ion-icon>OPEN PDF</ion-icon>
</button>
所以我不知道,我做错了什么。我收到很多错误:
So i don't know, what i am doing wrong. I am getting many error :
1。找不到模块找不到模块@ ionic-native / core
1. cannot find the module Cannot find module "@ionic-native/core"
请帮帮我出。我在我的代码中做错了什么...
please help me out. what i am doing wrong in my code...
提前致谢!!
错误:
ionic-hello-world@ /Users/apple/Desktop/ionic2-sidemenu-tabs-master
├── @ionic-native/core@3.7.0
└── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12
npm WARN @ionic-native/themeable-browser@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @ionic-native/core@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.
我的 package.json
:
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic-native/core": "^3.7.0",
"@ionic-native/themeable-browser": "^3.7.0",
"@ionic/storage": "1.1.7",
"ionic-angular": "2.0.0",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"sw-toolbox": "3.4.0",
"zone.js": "0.6.26"
}
更新:
错误:
update :
error:
1 无法解析为ThemeableBrowser设置所有参数:(?,?,?)。
2. 打字稿错误
模块'/用户/ apple / Desktop / ionic2-sidemenu-tabs-master / node_modules / ionic-native / dist / es5 / index'没有导出成员'ThemeableBrowserObject'。
src / app / app.component.ts
此行: import {ThemeableBrowser,ThemeableBrowserOptions,ThemeableBrowserObject}来自'ionic-native';
- 打字稿错误
模块'/ Users / apple / Desktop / ionic2-sidemenu-tabs-master / node_modules / ionic-native / dist / es5 / index'没有导出成员'ThemeableBrowserObject'。
src / app / app.module.ts
- Typescript Error Module '"/Users/apple/Desktop/ionic2-sidemenu-tabs-master/node_modules/ionic-native/dist/es5/index"' has no exported member 'ThemeableBrowserObject'. src/app/app.module.ts
此行: import来自'ionic-native'的{ThemeableBrowser,ThemeableBrowserOptions,ThemeableBrowserObject};
- 打字稿错误
模块'/ Users / apple / Desktop / ionic2-sidemenu-tabs-master / node_modules / ionic-native / dist / es5 / index'没有导出成员'ThemeableBrowserObject'。
src / pages / about / about.ts
- Typescript Error Module '"/Users/apple/Desktop/ionic2-sidemenu-tabs-master/node_modules/ionic-native/dist/es5/index"' has no exported member 'ThemeableBrowserObject'. src/pages/about/about.ts
此行: import来自'ionic-native'的{ThemeableBrowser,ThemeableBrowserOptions,ThemeableBrowserObject};
- 打字稿错误
物业'创建'类型'typeof ThemeableBrowser'上不存在。
src / pages / about / about.ts
- Typescript Error Property 'create' does not exist on type 'typeof ThemeableBrowser'. src/pages/about/about.ts
const browser:ThemeableBrowserObject = ThemeableBrowser.create('https://ionic.io','_ self',options);
推荐答案
我也遇到过这个问题。经过一些研究后,我通过在app.module.ts中导入 ThemeableBrowser 解决了这个问题,并将其作为提供者添加,然后导入所有 {ThemeableBrowser,ThemeableBrowserOptions,ThemeableBrowserObject} 您需要的文件。
I also faced this problem. After little research I solved it by importing "ThemeableBrowser" in app.module.ts and add the same as provider and after that import all { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject} in your required file.
解决方案:
app.module.ts:
import { ThemeableBrowser } from '@ionic-native/themeable-browser';
和
providers: [
StatusBar,
SplashScreen,
ThemeableBrowser,
{ provide: ErrorHandler, useClass: IonicErrorHandler },
// as per your requirement
]
然后在app.component.ts(或任何其他文件)中:
Then in app.component.ts (or any other file):
import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';
并编写代码。它会正常工作。
and write your code. It will work fine.
这篇关于离子2主题浏览器错误“"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!