Cordova插件不工作与离子 [英] Cordova plugins not working with ionic

查看:257
本文介绍了Cordova插件不工作与离子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Angular构建的Ionic应用程序。



我使用的是日历插件:
https: //github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin



我想通过插件创建事件并将其保存到本地设备的日历。 / p>

我已经添加了插件:

  cordova插件添加https: //github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin.git 

我尝试使用它in my controller:

  ionic.Platform.ready(function(){onError); 
window.plugins.calendar.createEvent(title,location,notes,start,end,onSuccess,onError);
});

在浏览器中,window.plugins是未定义的,在设备上的错误是'undefined'不是一个对象(评估'window.plugins.calendar')



我已经搜索了高和低的这个,我似乎找不到一个解决方案。 >

有任何想法如何使用Cordova插件与Ionic?

解决方案

是添加

 < script src =cordova.js>< / script& 

重建平台



问题未解决,删除和添加平台


I have an Ionic app built with Angular.

I am using is Calendar plugin: https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin

I want to create events through the plugin and save them to the local device's calendar.

I have added the plugin though:

cordova plugin add https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin.git

And I try to use it in my controller:

 ionic.Platform.ready(function(){onError);
    window.plugins.calendar.createEvent(title, location, notes, start, end, onSuccess, onError);
 });

In the browser it says window.plugins is undefined and on the device the error is 'undefined' is not an object (evaluating 'window.plugins.calendar')

I have searched high and low for this, I cant seem to find a solution that works.

Any idea how to use a Cordova plugin with Ionic?

解决方案

The answer was to add

<script src="cordova.js"></script>

And rebuild the Platforms

If still issue not resolved, remove and add the platforms

这篇关于Cordova插件不工作与离子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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