本文介绍了ionic 3本机插件停止工作.我尝试将ngx放到最后.红线错误消失了,但插件无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import { Market } from '@ionic-native/market/ngx';
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen,
private market: Market
) {
this.initializeApp();
this.market.open('io.ionic.expensemanager2018');
}
this.market.open('io.ionic.expensemanager2018');
我得到的错误是:
DetailsPage.html:95 ERROR TypeError: Object(...) is not a function
at Market.open (index.js:27)
at DetailsPage.webpackJsonp.52.DetailsPage.faq (details.ts:29)
at Object.eval [as handleEvent] (DetailsPage.html:95)
at handleEvent (core.js:13589)
at callWithDebugCon(core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at core.js:10629
at HTMLElement.<anonymous> (platform-browser.js:2628)
at t.invokeTask (polyfills.js:3)
我也尝试过降级该版本,但似乎没有任何效果.请帮忙.
I've have tried also degrading the version but nothing seems to be working. Please help.
推荐答案
在ionic.config.json文件中检查项目类型.
Check your project type in ionic.config.json file.
如果类型为离子角" ,则安装4.x.x版本.
If the type is "ionic-angular", then install 4.x.x version.
以您的情况
npm i -s @ionic-native/[email protected]
如果类型为角度" ,则安装5.x.x-beta版本
If the type is "angular", then install 5.x.x-beta version
npm i -s @ionic-native/[email protected]
注意:
仅当您使用 Angular 6
import { Market } from '@ionic-native/market/ngx';
如果未同时从app.module.ts和app.component.ts中的导入中删除ngx
if not remove ngx from the import both in app.module.ts and app.component.ts
import { Market } from '@ionic-native/market';
参考: https://github.com/ionic-team /ionic/issues/15225#issuecomment-414074074
这篇关于ionic 3本机插件停止工作.我尝试将ngx放到最后.红线错误消失了,但插件无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!