How to use cordova plugins in ionic?

I’m a beginner in cordova and ionic development and I want to know more about using cordova plugins in ionic application to create more powerfull mobile applications. I need some guidence and need your help to understand this concept.

My first question is:
As I’ve understood we can use how to use cordova plugins with ngCordova wrapper but for other third party cordova plugin ngCordova couldn’t help me. Is this true?

My second question is:
For example I want to use this helloworld plugin in ionic. Please write step by step guideline for beginner’s like me.

I know that how to install plugin with cordova CLI but I need to learn how to reference and use plugin in my ionic application:

cordova plugin add https://github.com/domaemon/org.apache.cordova.plugin.helloworld.git 

Thanks for your attention.

1 Like

ngCordova is a library of Angular wrappers for a collection of normal cordova plugins. You can use cordova plugins with or without an Angular wrapper in Ionic. There are lots of cordova plugins and not all have had a wrapper added to ngCordova yet.

As 2. says

Add ‘navigator.helloworld.say();’ in your deviceready callback.

In Ionic the equivalent of “deviceready callback” is in app.js → $ionicPlatform.ready(function() { }

so…

angular.module('starter', ['ionic'])
.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {

    // CALL YOUR PLUGIN CODE 
    navigator.helloworld.say()

    // other code here....
  });
})