Confusion with ng-Cordova and Plugins


I am trying to use this plugin - - with Ionic and ng-Cordova. I have added the plug-in and downloaded the latest ng-Cordova.

As per - I can get the Popup to display with

$cordovaAppRate.promptForRating(true).then(function (result) { });

However, it does not seem to expose the Preferences method.

For example, this will throw an error:

$cordovaAppRate.preferences.storeAppURL.ios = '';

Is this documentation saying that there is only one exposed method on it?

Looking at the ng-cordova.js file it seems to “wrap” the plugin methods with new methods:

// install  :     cordova plugin add
// link     :

angular.module('ngCordova.plugins.appRate', [])

  .provider("$cordovaAppRate", [function () {
this.setAppUrl = function (device, url) {
  var devices = ['ios', 'android', 'blackberry', 'windows8'];

  if (devices.indexOf(device) !== -1) {
    AppRate.preferences.storeAppURL[device] = url;
  else {
    alert("wrong device type");

this.useLanguage = function (language) {
  AppRate.preferences.useLanguage = language;

this.displayAppName = function (name) {
  AppRate.preferences.displayAppName = name;

It seems very easy to use the AppRate plugin directly - I am now not sure what the point of the ng-Cordova wrapper is - it seems like an unnecessary layer of complexity - please explain the benefits in this example.

I don’t know the answer to your question - but thank you for showing me this plugin. :smile:

Care to chime in on the @pbernasconi?

hmmm - I’m going to have to not use ng-Cordova then as I think it does not expose the required methods, but I am still curious to know how and when it should be used as per my original question.

@rodneyjoyce Sorry for the confusion there:

You can set the default preferences like so:

app.config(function($cordovaAppRateProvider) {

  document.addEventListener("deviceready", function () {

      $cordovaAppRateProvider.displayAppName("APP NAME");
      $cordovaAppRateProvide.setAppUrl("ios", "<my_app_id>");

    }, false);


I’ll make some changes to docs to account for this.

Thanks for clarifying. I am still confused as to why I would use ng-cordova wrapper instead of just this code (which I am using now): ie. what value does the wrapper add?

function initialise() {
                $ionicPlatform.ready(function() {
           = appConfig.androidStoreAppURL;
                    AppRate.preferences.storeAppURL.ios = appConfig.iOSStoreAppURL;


Your question actually caused me to refractor and change the way to set the default preferences. Now you can set preferences in 1 object. The docs for App Rate in have been updated to reflect the latest changes in the master branch.

Now to set the preferences do:

app.config(function ($cordovaAppRateProvider) {
  var prefs = {
    language: 'en',
    appName: 'MY APP',
    iosURL: '<my_app_id>',
    androidURL: 'market://details?id=<package_name>',
    windowsURL: 'ms-windows-store:Review?name=<...>'

  document.addEventListener("deviceready", function () {
  }, false)

@rodneyjoyce In reply to your question: ngCordova was made to make using cordova plugins easier to use and more AngularJS friendly. Even though the App Rate plugin is easy to use without ngCordova, using it with the ngCordova wrapper implements it in the best practice AngularJS way (eg, it uses promises, and sets preferences in the .config() phase of your app).

In the end it’s up to you whether you do it yourself or with ngCordova. And while ngCordova is still in the alpha version (with a few more bugs that need to be squished), in the near future, with the release of beta and v1.0, the docs will be complete for each plugin and hopefully few bugs will exist, making it very easy to use cordova plugins with ngCordova.

Thanks for the detailed explanation!