Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
940 views
in Technique[技术] by (71.8m points)

typescript - ionic 3 native plugins stopped working . I tried putting ngx at last.the red line error is gone.But the plugin is not working

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');

and the error I'm getting is:

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Check your project type in ionic.config.json file.

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

In your case

npm i -s @ionic-native/[email protected]

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

npm i -s @ionic-native/[email protected]

Note:

Add ngx at the end of import only if you are using Angular 6

import { Market } from '@ionic-native/market/ngx';

if not remove ngx from the import both in app.module.ts and app.component.ts

import { Market } from '@ionic-native/market';

Refencence:https://github.com/ionic-team/ionic/issues/15225#issuecomment-414074074


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...