Adding events to device calendar using Ionic framework


I'm creating a cross platform mobile app using Ionic framework and AngularJS In this app I need to get a date string and add it to the device's native calendar, is there a way to do so using only Ionic and AngularJS? and if there's no way to do so, can you tell me if there's a way doing so without them? Thank You !

Problem courtesy of: Joseph Khella


Check out the Angular wrapper for Cordova calendar:

Once you add ngCordova to your app.js and install the calendar plugin, you can inject $cordovaCalendar into your controller, then call it like this:

  $scope.createEvent = function(event){
    // Add to calendar interactively (vs silently):
      title: event.summary,
      location: event.location,
      notes: event.description,
      startDate: startsAt,
      endDate: endsAt
      // startDate: new Date(2015, 0, 6, 18, 30, 0, 0, 0),
      // endDate: new Date(2015, 1, 6, 12, 0, 0, 0, 0)
    }).then(function (result) {
      // success
    }, function (err) {
      // alert('Oops, something went wrong');
Solution courtesy of: Ira Herman


In general, you can start to answer questions like this by going to I went there, searched for calendar, and found multiple results, two of which look like may be perfect for you.

Discussion courtesy of: Raymond Camden

This recipe can be found in it's original form on Stack Over Flow.