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 !
Check out the Angular wrapper for Cordova calendar: http://ngcordova.com/docs/plugins/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):
$cordovaCalendar.createEventInteractively({
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');
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With