New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
window.plugins undefined #95
Comments
Hi, I don't use the Ionic CLI myself, but it as it's based on the Cordova CLI you could try this instead:
|
Thankyou so much, I will try this when I'm back, will let you know |
Unfortunately I tried it and the error on the device is 'undefined' is not an object (evaluating 'window.plugins.calendar') Do you think this is something that should work with ionic CLI? Thanks |
Try waiting for 'deviceready' document.addEventListener("deviceready", function() { |
I added that, it still came through as undefined. I already had the $ionicPlatform.ready(function(){ Which shows the plugins as undefined too. I'm pretty sure the above method handles the 'deviceready' event anyway. Have you heard of anyone using this successfully with Ionic? |
this person seems to have gotten it working: http://forum.ionicframework.com/t/eddy-verbruggens-calendar-plugin-with-ionic/3509 |
I have read that post, I dont really know what he's done differently, I know the plugin works, I have made a quick app and it works, i just dont know why it doesnt in my main app, there is not much structural difference, i will find out and post here. |
Was the app that works in Ionic? I'm still trying to learn how/why ionic loads cordova plugins differently. Maybe it is something to do with the live reloading feature. Have you looked at ng-cordova? This seemed like a good way to tie plugins into ionic. http://ionicframework.com/blog/ng-cordova/ |
It was an Ionic app, just a single controller, with a method to call the calendar, it works fine. I have looked at ng-cordova, alas there is no calendar support |
why not add it? i'm curious if that would work. https://github.com/driftyco/ng-cordova/blob/master/src/plugins/datepicker.js the main reason that adding it via ng-cordova might be better is that i think/hope the initialization code timing is handled for you. i want to try wrapping another plugin that does not seem work either - same issue of window.plugins being undefined. i did wonder if trying an older version of ionic might help - if there have been some regressions or api changes. |
I imagine some issues on the timings would be added for you, I just dont think my app has the same issue. Which plugin doesnt work for you? |
i've been trying to get http://ngcordova.com/docs/#BackgroundGeolocation working in ionic. and i'm wrong about wrapping it - it is already wrapped by ngCordova. i started off with a simple app first, but no luck. pretty annoying but I suspect it is something stupid i am doing or a version/regression issue. i'll dig into how these plugins are wrapped and perhaps that'll shed some light. |
good luck - let me know how you get on, ill share any joy I have |
i also tried using that plugin directly, without wrapping. in both cases the window.plugins code was undefined. i did find an issue where the plugin author said that another plugin had polluted the namespace (i think the push plugin - not sure) with code like this |
hmm, I'm not using any others apart from the default ionic ones, dont think that would be my issue |
Found my issue! I had to add to my html, the first script, even though I dont have the file. Very strange, havent come across this before but found it through process of elimination. Thanks for the help Eddy |
@bentaly cool, if you can, can you add an escaped version of the thing you had to add (for future reference)? Thx! |
to what @EddyVerbruggen says - use backticks around the code sample. It is a shame that github does not handle that by default instead of dumping it. |
@carchrae +1 on that |
haha didn't notice it cut it out - I simply had to add
Which is 404 during development but the script seems to be injected to the root at runtime when on a device. |
I have a problem on IOS no errors no succes all methods have been recognized but no items in calendar does someone have an idea ? |
is it in the: |
No its after Deviceready has been fired android version works well |
Hi @GSD-Automatisering , |
Has anyone resolved the issue? I'm getting this error even though I load cordova.js at the beginning! |
Anyone?? |
am here too soon :( |
Have you tried window.onload in your index.html? window.onload = function() {
app.initialize()
} And of course the holy grail in phonegap or cordova development: phonegap platform rm YOURPLATFORM
phonegap platform add YOURPLATFORM
phonegap build YOURPLATFORM This fixes almost every incomprehensible bugs for me. |
Will do.... thanks
…On Tue 14 Jul 2020 at 08:32 Marcel Bich ***@***.***> wrote:
Have you tried the following in your index.html?
In some of my phonegap apps this helped out:
window.onload = function() {
app.initialize()
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#95 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFSAZT6PM4FSG3S5PBSWA2DR3P3XZANCNFSM4AT2J37Q>
.
|
(window as any).cordova.plugins.[pluginName] |
Hi,
I am using ionic and want to save events to the native calendar.
Firstly, can this be done with your plugin? I'm under the assumption it can. if not, let me know and read no further.
I added your plugin on the command line with
ionic plugin add https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin.git
and then in my app call
var cal = window.plugins.calendar;
cal.createEventInteractively(title, location, notes, start, end, onSuccess, onError);
In the browser (which is the only place I can debug) window.plugins is undefined.
On the device it seems nothing happens.
Any idea what might be the issue?
Sorry to bother you, any help would be appreciated.
Ben
The text was updated successfully, but these errors were encountered: