Angularjs 在ui calendar中显示日历上的表单数据并将其保存在fireabase中
我正在使用UI Calendar(),我希望填写的表单显示在各自的日历条目上,并保存在firebase数据库中。我该如何做?目前表单数据没有显示在日历上 appointment-maker.js文件Angularjs 在ui calendar中显示日历上的表单数据并将其保存在fireabase中,angularjs,calendar,firebase,angularfire,Angularjs,Calendar,Firebase,Angularfire,我正在使用UI Calendar(),我希望填写的表单显示在各自的日历条目上,并保存在firebase数据库中。我该如何做?目前表单数据没有显示在日历上 appointment-maker.js文件 'use strict'; /** * @ngdoc function * @name appointment1App.controller:CalendarCtrl * @description * # CalendarCtrl * Controller of the appointm
'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
此处填写代码您是否在代码中的任何位置使用
$firebase
或firebase
?上面的代码片段中没有它们,这将大大有助于解释为什么表单控件和Firebase之间没有数据绑定。我是在config.js文件中这样做的。完整的代码在这里,请更新您的问题,以包含问题的最小自包含复制。但是从中我看到,没有任何东西将AngularFire同步对象绑定到作用域。该代码通常也会出现在您的日历Ctrl
中,类似于您在任命makerctrl
中对消息数组执行此操作的方式。我添加了内容以使其自包含,并添加了github url。如何将AngularFire对象绑定到范围?该配置片段刚刚设置了Firebase url。由您自己的代码创建一个Firebase
ref,然后创建一个$Firebase
sync对象,将其强制转换为$asObject()
。一旦有了它,就可以将其绑定到角度模型。AngularFire快速入门中介绍了所有这些步骤:
<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>
.constant('FBURL', 'http://dazzling-fire-6922.firebaseio.com');