I'm using below eventClick which is a property of fullCalendar callback. 
This is triggered every time an event is clicked on the calendar:

calEvent.fullCalendar({ .........
eventClick: function(calEvent, jsEvent, view) {
    scheduleService.get({id: calEvent.id}, function(schedule) {
        console.log(schedule);
        $scope.userForm.client.name = schedule.client.name;
        $scope.openAppointmentDialog();
    });...

I'm setting this $scope.userForm.client.name when event is clicked and 
$scope.openAppointmentDialog() calls below:

$scope.openAppointmentDialog = function () {
    ngDialog.openConfirm({
        template: 'appointment-form',
        //controller: 'ARScheduleCtrl',
        //cache: false,
        className: 'ngdialog-theme-default',
        preCloseCallback: function (value) {

            var nestedConfirmDialog = ngDialog.openConfirm({
                template: '<p>Are you sure you want to close?</p>' +
                '<div>' +
                    '<button type="button" class="btn btn-default" 
ng-click="closeThisDialog(0)">No</button>&nbsp;' +
                    '<button type="button" class="btn btn-primary" 
ng-click="confirm(1)">Yes</button>' +
                '</div>',
                plain: true,
                className: 'ngdialog-theme-default'
            });

            return nestedConfirmDialog;
        },
        scope: $scope
    })
        .then(function (value) {
            // Perform the save here
            if(value === 'Save') {
                toaster.pop('success', 'Appointment', 'Appointment has been 
successfully saved!');
            }
        }, function (value) {
            // Performs cancel actions
            if(value === 'Cancel') {
                calendar.fullCalendar('removeEvents', $scope.currentEvent.id);
            }
        });
};

The form has ng-model as userForm.client.name but this is never initialized 
with eventClick. This however works when I set this outside fullCalendar 
method.

How do I initialize this model field in the ngDialog template inside this 
callback event?

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to