Load Cordova plugin and ionic-native


#1

I run this and add plugin
ionic plugin add cordova-plugin-wechat --variable wechatappid=wx4a525790c75c494f

But I can’t import plugin from ionic-native. How can I make it available to app?


#2

If the plugin isn’t available in Ionic Native then just use it like a normal Cordova plugin, no need to import anything. If you’re using TypeScript you’ll get warnings about missing types, but you can safely ignore those.


#3

error : cant find Wechat. this is a typescript error. This occured when I run ios , ngc failed and cant go ahead


#4

TypeScript needs types for the variables, so you can either install the types, use Ionic Native which handles it automatically if the plugin is available there, or you can just add this above your decorator:

declare var Wechat: any;

which should supress any TypeScript errors.


#5

Thank you very much. This saved me. I successfuly used Cordova plugin in ionic 2. Then I missed another error. When I run ionic serve , chrome find an error : Wechat is not defined, and crash.
How can I tell browser to ignore this error? I used if(Wechat){} , but the same error.