ngCordova installation + using the cordova plugin


#1

Hi,

What I’m trying to do is to install http://ngcordova.com/ and the cordova sqlite plugin ( https://github.com/brodysoft/Cordova-SQLitePlugin ) and make them work in my test app :smile: (originally my app is the default tabs app)

There are couple of questions then:

  1. If I understood right, the way how the ngCordova should be installed is the git clone to the /www/lib . So then, in the index.html, we should include the

(however, on the site it says to include the /lib/ngCordova/dist/ng-cordova.js , I don’t understand how they get the different folder name )

I’ve tried install it as cordova plugin:

Question:
Is that’s the correct way of installing the ng-cordova?

  1. From the other point I’m trying to install the sqlite plugin.

However it’s not clear - should I somehow include the js of it in my index.html, or it would be included automatically ? Any of my tries to include or use it had not lead to the success. Evenmore, when I try to build the project for ios, I see the next:

As you see - it’s not able to find the plugins file.

Question:
What I’m doing wrong, how should I add the plugin to the project after I’ve added it as cordova plugin?

Any thoughts are appreciated.

Regards,


Announcing ngCordova: Simple Cordova plugin wrappers with angularJS
#2

No, the way your are trying is wrong.

First you can download the ng-cordova using the custom build in ng-cordova website, there you can create your “version” of ng-cordova with just the parts you really want, if you just want the SQLitePlugin you can create a custom “version” that just bring the SQLitePlugin, this will make your app more lite and just with you really want.

After that you can add the ng-cordova file to your project a link it in your html page.
Then you need to install the plugin of the ng-cordova “plugins” you need, if you want to install the SQLitePlugin to use with ng-cordova you need to run this command:
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git

You can find more about in the ng-cordova doc page: http://ngcordova.com/docs/

If you need more help, ask here.


#3

Thanks,

The way of ng-cordova installation is now clear.

However, the sql plugin still doesn’t work correctly.
I’ve it installed, which could be confirmed by:

But, when I’m trying to build the app I still see the next:

And to double check - should I manually include the plugin js file to the index.html or it would be done automatically?


#4

You should add manually, did you try the custom-build in ng-cordova website?


#5

ng-Cordova is ok, I’m talking about the sqlite module


#6

However,

I really don’t see the sqlite plugin in the folder where it tries to search for it:


#7

Ok, let’s try from zero. Delete the your ng-cordova, and remove the sqlite plugin. Then create a new custom build with just the things you need in ng-cordova, then run the command to add again the sqlite plugin to your project, link you ng-cordova js file to you html and just try to run the ionic build ios and see if some error appears.


#8

As ng-cordova is just a js script, I don’t think that I should remove it.
However, I’ve removed the old “cloned” version of course. Currently the only ng-cordova file is the custom build, which includes the sqlite plugin support.

Here is the video, which shows that the clean project builds well, but as soon as I would add the plugin - it started to fail.

When I build it for android all goes well.


#9

And another thing which I spot.

The ng-cordova.js file which I’ve downloaded requires the ngCordova.plugins:

However, there are no such module in the project. Where should I get it?


#10

That’s strange I never got this error before, I have a project here and I use the ng-cordova with sqlite, I run: ionic build ios and everything runs OK. What is your xcode version?


#11

The version is:

Xcode 5.1.1
Build version 5B1008

Could you, please, check if your ng-cordova reguire the ngCordova.plugins as well? And how does your application finds that module.

Regards,


#12

Yes it requires. But even with this requirement I can do the ionic build ios and everything works fine


#13

Could you please check one more thing - do you have the plugins files under:
projectName/platforms/ios/projectNames/Plugins ?

There should be the com.* plugin folder, as I expect.

Regards.


#14

Yes, all my plugins are there. Check you have write permissions to your <project>/platforms folder.


#15

For me whenever I add a cordova plugin to an existing IOS project, I’ve have to remove the platform and then re-add it. Annoying.

cordova platform rm ios
cordova platform add ios


#16

Thanks man,

This really solves the issue


#17

How to add cordova plugin on Windows 7 in VisualStudio project?
Where should I perform this command “cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git” ?


#18

Navigate to you project directory in the cmd and enter the following command:

ionic plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git

#19

I received the following answer:
‘ionic’ is not recognized as an internal or external command,
operable program or batch file.


#20

@dmitry You can run commands cordova? for example, cordova plugin ls
If you can and you send the error that is not recognized as ionic command, check your PATH, I spend my something and reinstall ionic, check the path and everything works ok.