ionic 3 本机插件停止工作.我最后试了下 ngx.红线错误消失了.但是插件不起作用 [英] ionic 3 native plugins stopped working . I tried putting ngx at last.the red line error is gone.But the plugin is not working

查看:16
本文介绍了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.

如果类型是ionic-angular",则安装4.x.x版本.

If the type is "ionic-angular", then install 4.x.x version.

就你而言

npm i -s @ionic-native/market@4.20.0

如果类型是angular",则安装5.x.x-beta版

If the type is "angular", then install 5.x.x-beta version

npm i -s @ionic-native/market@5.0.0-beta.24

注意:

仅当您使用 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.红线错误消失了.但是插件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆