search

Home  >  Q&A  >  body text

angular.js - Ionic2中如何调用Cordova插件?

请问如何在基于Typescript的ionic2中调用cordova插件呢?
插件是自己写的,不能使用ionic-native。
如何获取插件的实例呢?比如导出插件叫plugin
根据网上一些说法先:

declear var window: any;

然后在代码中调用,比如在生命周期函数ionViewLoaded中:

window.plugin.someMethod();

但是无法获取到pluigin实例,请假如何调用?

某草草某草草2742 days ago568

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