Cordova.js vs ng-cordova.js


#1

Hello, Just like to confirm, if we are using ng-cordova.js, then no need to include cordova.js in our app is it correct?


#2

No, you still need cordova.js.

NG-cordova is just an angular service that lets you have easier access to cordova’s plugins. It has nothing to do with the actual function of cordova.

Thanks for bringing this up! :smile:


#3

ok then, i am finding an issue. May you can help me. Its difficult to codepen. But I explain here.

I am working on android app which has couple of features

  1. Taking picture from my app - using “ng-cordova”.
  2. Calendar support - I am using http://arshaw.com/fullcalendar/. I integrated to my app.

Now what happens is, when ever I tap on either “>” or “<” of my calendar control, mouse click events are invoking twice. When I debug I found that mouse events are registering to “Cordova.js” and “ng-cordova.js”.

What I did was, I removed “cordova.js” from my includes. (in index,html). Then, I am seeing correct behaviour.

Any idea why it might happening or am I doing some thing wrong?


#4

Hmm, with out seeing any code, I can’t be too sure. I see that the calendar is a jquery plugin, which could be causing issues. Check out angular-ui calendar

http://angular-ui.github.io/ui-calendar/http://angular-ui.github.io/ui-calendar/

It’s based on arshaw’s calendar, but optimized for angular


#5

mhartington, sorry for confusion. I am using http://angular-ui.github.io/ui-calendar/. Which has jquery dependency eventhough.

Please see my other post which you suggested, :smile:

I will try to do a code pen or share code in skydive. Between I developed my code using telerik app builder. Do you have app builder with you?


#6

Ha, sorry about that, so many questions and people it’s hard to remember who’s who.

I do not use app builder, but you can share a zip with me via google drive


#7

Here is location where I shared code.

https://drive.google.com/file/d/0B8Tk-crHAlgNWWIwMnZXTE1RWjg/edit?usp=sharing

let me knwo if you can access this. Thanks for you time man.


#8

forgot to explain steps to reproduce:

  1. once app is loaded click on “Click for Calendar View”
  2. Now, you should see “Calendar View”.
  3. To reproduce, just click on “>” or “<” buttons. You should see day jumps 2 days ahead or back.
  4. Also, if you click on calendar you should see alert for 2 times.

Thanks.


#9

Got it, so on lines 16 and 17, you have cordova and ng-cordova. Switch them around and things should work good.

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

As per the docs.

http://ngcordova.com/docs/


#10

hmm, no luck. I am still seeing the same. PLease let me know if there is any thing I should try.

Thanks.


#11

Alright, so there were a bunch of errors in the file. Some how, cordova was added twice, markup was all messed up and code was just a bit out of order. A bit too much to explain. So I packaged it up for you to take a look at and compare.

https://drive.google.com/file/d/0B8XTjPU0PxurVXYtQjNiMGVVUzg/edit?usp=sharing