ngCordova installation + using the cordova plugin

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,

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.

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?

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

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

However,

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

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.

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.

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?

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?

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,

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

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.

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

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

Thanks man,

This really solves the issue

How to add cordova plugin on Windows 7 in VisualStudio project?
Where should I perform this command “cordova plugin add GitHub - storesafe/cordova-sqlite-storage: A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API” ?

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

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

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

@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.