Adding ngCordova to Ionic

Once you’ve got Ionic installed, installing ngCordova can be nice because (as I found out recently), Ionic doesn’t include a good way of accessing Cordova/Phonegap’s plugins. ngCordova is basically a collection of Angular services that allow you to use Cordova’s plugins.

To install (after already having installed Ionic and all of its dependencies), you’ll need to install “bower” (if you haven’t done so already for some other reason):

sudo npm install -g bower

Then you need to add the following to your index.html in your project:


And then add ngCordova as a dependency to the app (file may be app.js):

angular.module('app', ['ionic', 'app.controllers', '', 'ngCordova'])

Then add the plugin(s) you want like so:

ionic plugin add cordovaPluginName

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: