search

Home  >  Q&A  >  body text

angular.js - How to call Cordova plugin in Ionic2?

How to call the cordova plug-in in ionic2 based on Typescript?
The plug-in is written by myself and cannot use ionic-native.
How to get the instance of the plug-in? For example, the export plug-in is called plugin
. According to some opinions on the Internet:

declear var window: any;

Then call it in the code, such as in the life cycle function ionViewLoaded:

window.plugin.someMethod();

But the plugin instance cannot be obtained. How to call for leave?

某草草某草草2772 days ago597

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-15 17:07:10

    Click window.cordova in Console to see what is included, and then search step by step. Most likely there is window.cordova.plugin(s)

    reply
    0
  • Cancelreply