I have the code below in my app's controller which does not seemed to be working. Testing it on the browser gives me this error "TypeError: Cannot read property 'plugins' of undefined". Note that the alert inside the .then is not displayed even if I emulate on a device.
angular.module('controllers', ['ionic', 'ngCordova'])
.controller('MainCtrl', function($scope, $ionicSideMenuDelegate, $ionicPlatform, $cordovaLocalNotification, GoogleMaps) {
// Change Map Type
$scope.setMapType = function(newMapType) {
GoogleMaps.setMapType(newMapType);
alert("Setting notification");
// Supposed to trigger a notification
$cordovaLocalNotification.schedule({
id: 1,
title: 'Instant',
text: 'Instant Notification',
}).then(function (result) {
alert("Instant Notification set");
});
};
});
I've also imported ng-cordova.min.js, and cordova.js in the index.html. I also did cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git already. Any ideas why it might not be working?