在ui-calendar中显示日历上的表单数据并将其保存在firebase中

时间:2014-08-27 17:00:56

标签: angularjs calendar firebase angularfire

我正在使用UI-Calendar(http://arshaw.com/fullcalendar/),我希望填写的表单在相应的日历条目中显示并保存在firebase数据库中。我该怎么办?目前表格数据没有在日历上显示出来?

appointment-maker.js文件

'use strict';

/**
 * @ngdoc function
 * @name appointment1App.controller:CalendarCtrl
 * @description
 * # CalendarCtrl
 * Controller of the appointment1App
 */
angular.module('Appointment1app')
    .controller('CalendarCtrl', function ($scope) {

        function dayClick() {
            $scope.templates.myTemplate = "views/appointment-maker.html";
        }

        function eventDrop() {

        }

        function alertOnResize() {

        }

        $scope.eventSources = [];
        $scope.uiConfig = {
            calendar: {
                height: 450,
                editable: true,
                header: {
                    left: 'month basicWeek basicDay agendaWeek agendaDay',
                    center: 'title',
                    right: 'today prev,next'
                },
                dayClick: dayClick,
                eventDrop: eventDrop,
                eventResize: alertOnResize
            }
        };
    });

calendar.js

'use strict';

/**
 * @ngdoc function
 * @name appointment1App.controller:CalendarCtrl
 * @description
 * # CalendarCtrl
 * Controller of the appointment1App
 */
angular.module('Appointment1app')
    .controller('CalendarCtrl', function ($scope) {


        function dayClick() {
            $scope.templates.myTemplate = "views/appointment-maker.html";
        }

        function eventDrop() {

        }

        function alertOnResize() {

        }


        $scope.eventSources = [];
        $scope.uiConfig = {
            calendar: {
                height: 450,
                editable: true,
                header: {
                    left: 'month basicWeek basicDay agendaWeek agendaDay',
                    center: 'title',
                    right: 'today prev,next'
                },
                dayClick: dayClick,
                eventDrop: eventDrop,
                eventResize: alertOnResize



            }
        };
    });

HTML

<form ng-controller="AppointmentMakerCtrl"
      ng-submit="onSubmitAppointment()">
    <div class="form-group">
        <label>Name</label>
        <input class="form-control"
               ng-model="newAppointment.name">
        <label>Email</label>
        <input class="form-control"
               ng-model="newAppointment.email">
        <label>Notes</label>
        <input class="form-control"
               ng-model="newAppointment.notes">
    </div>
    <button class="btn btn-primary" type="submit" 
    ng-click="onCreateAppointment()">Create Appointment</button>

    <!-- <ul>
        <li ng-repeat="message in messages">{{message.value}}</li>
    </ul> -->
</form>

config.js文件

  .constant('FBURL', 'http://dazzling-fire-6922.firebaseio.com');

此处填写代码https://github.com/matif84/class-project-angularjs

0 个答案:

没有答案