【发布时间】:2015-05-02 22:57:18
【问题描述】:
我正在尝试将angular-ui-calendar 与angular-dragDrop 一起使用来创建类似于fullcalendar 中的示例的内容,其中可以将外部事件拖到日历中。
我已经检查了How to drag&drop elements onto a calendar with angular directives only 线程,但我不知道如何获取我放入 callendar 并添加到事件数组的对象。
Here is my trying
-
景色
<div id="wrap"> <div id="external-events"> <h4>Draggable Events</h4> <label ng-repeat="item in eventList"> <div class="fc-event" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" jqyoui-draggable="{index: {{$index}},placeholder:true,animate:true}">{{item.title}}</div> </label> </div> <br /> <div style="clear:both"></div> <div class="calendar" ng-model="eventSources" calendar="myCalendar1" ui-calendar="uiConfig.calendar" data-drop="true" jqyoui-droppable="{multiple:true}"></div> </div> -
控制器
app.controller('MainCtrl', function($scope) { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $scope.eventList=[ {title:'Event 1'}, {title:'Event 2'}, {title:'Event 3'}, {title:'Event 4'} ]; $scope.eventSources=[]; $scope.events = [ {title: 'All Day Event',start: new Date(y, m, 1)}, {title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false}, {title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'} ]; $scope.uiConfig = { calendar:{ height: 450, editable: true, droppable: true, drop: function (date, allDay, jsEvent, ui) { console.log('Here ,but where is the object?'); }, header:{ left: 'title', center: '', right: 'today prev,next' } } }; $scope.eventSources = [$scope.events];}
提前感谢您的帮助
【问题讨论】:
-
您找到解决问题的方法了吗?我遇到了同样的问题,没有 ui-calendar 和拖放的例子...
-
我的一个项目遇到了类似的情况,有人有解决这个问题的方法或我们可以使用的任何其他库吗?
标签: angularjs calendar angular-ui angular-dragdrop