Announcing ngCordova: Simple Cordova plugin wrappers with angularJS

Hey everyone,

We released the first version of ngCordova today, an open source set of AngularJS services and extensions to make using Cordova plugins in your Ionic apps incredibly easy. Read the full release info here: http://ionicframework.com/blog/ng-cordova/

If you’ve ever used a Cordova plugin but had difficulty incorporating it into your Angular code, ngCordova was made for you. Give it a try, and let us know what you think about it!

Soon, we will be adding support for mocking plugins for testing purposes (think testing Geolocation data, or simulating a device shake), and also making plugins not fail if Cordova isn’t present.

From all of us on the Ionic team, we hope you love ngCordova!

http://ionicframework.com/blog/ng-cordova/

43 Likes

This topic is now pinned. It will appear at the top of its category until it is either unpinned by a moderator, or the Clear Pin button is pressed.

nice idea,
now the code looks cleaner and we have no problem with asynchronous plugins, thanks for that.

can you please add the “org.apache.cordova.file” plugin next

Here is my file service i have created it for my app, hope it helps
" https://gist.github.com/maleeb/3bed0cf3d51831909a61 "

thanks :smile:

1 Like

Hey Max! This is really cool. When will the media plugin be supported? If it is really soon then I will wait for that before releasing my app.

1 Like

This is fantastic. Thanks @max!

+1 to see support for the File plugin as well as the push notifications plugin: https://github.com/phonegap-build/PushPlugin

That’d be amazing.

5 Likes

This is great thank you!

A similar wrapper for iOS In-App-Purchases https://github.com/AlexDisler/ng-storekit

@maleeb I ported your file service into ngCordova PR: https://github.com/driftyco/ng-cordova/pull/29, please make as many improvements as you see fit!

@Alexd Do you want to try and port that into ngCordova as a PR? Since the project is only a few days old and in very alpha stages, I’m sure max will accept it and it can be improved upon in the near future. The naming conventions are $cordova<<PluginName>>.

3 Likes

Exactly at the time when I was in need on it. Thank you team

// Clear a watch by watchID
$cordovaDeviceMotion.clearWatch(watchID); does not work
TypeError: Cannot read property ‘clearWatch’ of undefined

@pcr do you mind making an Issue on github, with some more detail please?

Perfect job, braaaaaaaaaaaaavvvvvvvvvvvvvvvvooooooooooo.!!!
Have you any plans about SQLite Plugin?

Thanks
Dimitris

1 Like

@pcr Check out the updated docs for Device Motion.

You have to first obtain the watchID like:
var watchID = $cordovaDeviceMotion.watchAcceleration(options).then(...)
then use watchID in the clearWatch method.

@dimitrisplus SQLite has been added, but lacks some functionality, so maybe use it as a base for your SQLite use.

Hello ionic Team.
Thank you very much!!

Thanks for this library; tho I’m still having trouble with it. I made a demo app based on the one included with the library; when I run it in the Android emulator I don’t even get device info (see ‘device’ page). I’ve added all the plugins and have everything referenced as I saw in the documentation. Github here:

https://github.com/phaggood/ngcordovademo

Add this line back: https://github.com/phaggood/ngcordovademo/blob/master/www/index.html#L22

You need cordova.js for it to work.

This is GREAT! GREAT! GREAT! Excellent work. Have several problem with cordova.js before

Got it working, it appears it was the order of the scripts (cordova 1st, ngcordova 2nd) and an update to the ngcordova script itself. To create the app, I executed the following commands:

ionic start ionicngcordova blank
cordova plugin add org.apache.cordova.device

(added templates, routing and controllers via editor)
ionic platform add android
ionic emulate android

Grab it here, push up to PhoneGap build to try on your mobile device.

https://github.com/phaggood/ionicngcordova.git

Is it possible to have a ngCordova wrapper also for the Facebook plugin? Thx!

Great job on this guys. Super good work!

Awesome job guys I am playing around with this now :smile:

I have a question… Anyone have a gut feel as to whether or not this would be quicker than the “long way” of using Cordova plugins? Wonder if there’s any slight performance benefit here? Just curious :smile:

Keep up the awesome work!
Ed