Jos*_*lla 4 mobile cross-platform date angularjs ionic-framework
我正在使用Ionic框架和AngularJS创建一个跨平台移动应用程序在这个应用程序中我需要获取一个日期字符串并将其添加到设备的本机日历中,有没有办法只使用Ionic和AngularJS?如果没有办法这样做,你能否告诉我,如果没有它们,是否有办法这样做?谢谢 !
查看Cordova日历的Angular包装器:http: //ngcordova.com/docs/plugins/calendar/
将ngCordova添加到app.js并安装日历插件后,可以将$ cordovaCalendar注入控制器,然后调用它:
$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');
});
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9295 次 |
| 最近记录: |