New! Check out Ionic Native. It's like ngCordova but for ES6 and TypeScript.

$cordovaBadge

Access and modify the badge number of the app icon on various mobile platforms including iOS, Android and Windows Phone.

cordova plugin add https://github.com/katzer/cordova-plugin-badge.git

Methods

hasPermission()

Determine if the app does have the permission to show badge notifications.

module.controller('MyCtrl', function($cordovaBadge) {

  $cordovaBadge.hasPermission().then(function(yes) {
    // You have permission
  }, function(no) {
    // You do not have permission
  });

});

set(badge, callback, scope)

Set a number to display on the badge.

module.controller('MyCtrl', function($cordovaBadge) {

  $cordovaBadge.set(3).then(function() {
    // You have permission, badge set.
  }, function(err) {
    // You do not have permission.
  });

});

get()

Get the current badge number displayed.

module.controller('MyCtrl', function($cordovaBadge) {

  $cordovaBadge.get().then(function(badge) {
    // You have permission, badge returned.
  }, function(err) {
    // You do not have permission.
  });

});

clear(callback, scope)

Clear the current badge number displayed.

module.controller('MyCtrl', function($cordovaBadge) {

  $cordovaBadge.clear().then(function() {
    // You have permission, badge cleared.
  }, function(err) {
    // You do not have permission.
  });

});

increase(count, callback, scope)

Increase the current badge number displayed by the number provided. If number is not passed, badge will increase by 1.

module.controller('MyCtrl', function($cordovaBadge) {

  $cordovaBadge.increase(count).then(function() {
    // You have permission, badge increased.
  }, function(err) {
    // You do not have permission.
  });

});

decrease(count, callback, scope)

Decrease the current badge number displayed by the number provided. If number is not passed, badge will decrease by 1.

module.controller('MyCtrl', function($cordovaBadge) {

  $cordovaBadge.decrease(count).then(function() {
    // You have permission, badge decreased.
  }, function(err) {
    // You do not have permission.
  });

});