md-dialog 不在当前日历上呈现

md-dialog does not render on the current calendar

我正在使用 fullcalendar 在日历中显示一系列记录。它工作得很好。

我现在正在尝试添加单击一天以添加新事件的功能。我在下面添加了 dayClick 代码:

$("#calendar").fullCalendar({
    ...
    dayClick: function (date, jsEvent, view) {
        $scope.AddDailyRecord(date);
    },
    ...
});

函数AddDailyRecord如下:

$scope.AddDailyRecord = function (date) {
    if (date) {
        $scope.reportDate = date.format("YYYY-MM-DD");
        $scope.reportToDate = date.format("YYYY-MM-DD");
    } else {
        var newDate = moment(new Date()).format("YYYY-MM-DD");
        $scope.reportDate = newDate;
        $scope.reportToDate = newDate;
    }
    $scope.statusJob = "";
    if ($scope.statusDetForeman)
        $scope.dailyRecordForeman = $scope.statusDetForeman;
    else
        $scope.dailyRecordForeman = appData.user;

    $scope.showDailyRecordDiv = true;
}
$scope.closeDailyRecordDialog = function () {
    $scope.showDailyRecordDiv = false;
}

此按钮已使用相同的代码:

<button class="md-raised md-primary detailGridAddButton md-button md-ink-ripple" 
        type="button" ng-transclude="" ng-click="AddDailyRecord()">
   <md-icon class="ng-scope material-icons" role="img" aria-label="add">add</md-icon>
   <div class="md-ripple-container" style=""></div>
</button>

这是有问题的 md-dialog(显示我如何切换 show/hide):

<div id="dailyRecordDiv" class="md-dialog-container ng-scope full-height" 
     ng-show="showDailyRecordDiv">
    <md-dialog>
        <md-toolbar>
            ...
        </md-toolbar>
        <md-divider></md-divider>
        <md-dialog-content class="md-dialog-content">
            <form name="dailyRecordform" novalidate>
                ...
            </form>
        </md-dialog-content>
    </md-dialog>
</div>

当我单击按钮时,它会正确显示对话框。但是,当我单击代码执行的那一天时,却没有对话框。但是,如果我单击日历箭头查看另一个月份(之前或下个月),就会出现对话框。

我需要做什么才能让它呈现在当前日历上?

运行

之后
$scope.AddDailyRecord(date);

运行适用范围

$scope.$apply()

fullCalendar dayClick 回调在您的控制器范围之外。