angularjs - 如何更改全日历单元格颜色?

标签 angularjs fullcalendar cell

我正在尝试更改 AngularUI 的日历单元格颜色。

但始终只更改事件颜色。

如何更改日单元格颜色?

这是我用于设置事件的 Angular 代码:

$scope.events = [
    {className: 'fa fa-shopping-basket', title: 'dashboard', start: new Date(y, m, 1), url: 'http://localhost/view_finance', backgroundColor: '#80d4ff', borderColor: '#80d4ff', textColor: '#0088cc', allDay: true},
    {className: 'fa fa-line-chart', title: 'dashboard 2', start: new Date(y, m, 1), url: 'http://localhost/view_finance/d/dash2', backgroundColor: '#80d4ff', borderColor: '#80d4ff', textColor: '#0088cc', allDay: true},
    {className: 'fa fa-user', title: 'balance', start: new Date(y, m, 1), url: 'http://localhost/view_finance/d/balance', backgroundColor: '#80d4ff', borderColor: '#80d4ff', textColor: '#0088cc', allDay: true},
    {className: 'fa fa-bar-chart', title: 'invoice', start: new Date(y, m, 5), url: 'http://localhost/view_finance/invoice/invoice#!/invoice_view', backgroundColor: '#80d4ff', borderColor: '#80d4ff', textColor: '#0088cc', allDay: true},
    {className: 'fa fa-bar-chart', title: 'documents', start: new Date(y, m, d - 3, 16, 0), url: 'http://localhost/view_finance/files/browse/home', backgroundColor: '#80d4ff', borderColor: '#80d4ff', textColor: '#0088cc', allDay: true},
    {title: 'control side', start: new Date(y, m, d + 4, 16, 0), url: 'http://localhost/view_finance/manage/dashboard', backgroundColor: '#80d4ff', borderColor: '#80d4ff', textColor: '#0088cc', allDay: true},
    {title: 'balance', start: new Date(y, m, d + 1, 19, 0), end: new Date(y, m, d + 1, 22, 30), url: 'http://localhost/view_finance/d/balance', backgroundColor: '#80d4ff', borderColor: '#80d4ff', textColor: '#0088cc', allDay: true},
    {title: 'invoice settings', start: new Date(y, m, 28), end: new Date(y, m, 29), url: 'http://localhost/view_finance/invoice/invoice#!/invoice_setting', backgroundColor: '#80d4ff', borderColor: '#80d4ff', textColor: '#0088cc', allDay: true}
];

这是我目前的看法

enter image description here

最佳答案

最后我做到了它的工作

$scope.uiConfig = {
    calendar: {
        height: 650,
        editable: true,
        header: {
            left: '',
            center: 'prev title next',
            right: ''
        },
        defaultView: 'month',
        dayRender: function (date, cell) {
                 $r = $scope.getDateInfo(date);
                if($r){
                   cell.css("background-color", "#ccf3ff"); 
                }
                cell.html('<i class="fa fa-line-chart"  ></i>'+$r.amount+'<br/><i class="fa fa-user" ></i>'+$r.users+'<br/><i class="fa fa-shopping-basket" ></i>'+$r.income);
            }

    }
};

$scope.getDateInfo = function(date){
    return {
             amount : 50000,
             users  : 10,
             income : 5000
            } 

}

这是我对硬编码值的看法

enter image description here

关于angularjs - 如何更改全日历单元格颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41825303/

相关文章:

javascript - 从 AngularJS 中的两个资源调用返回 $promise 以延迟路由更改

angularjs - 如何在angularjs中按降序排列对象数组?

javascript - 尝试在 https ://api. thetvdb.com/向 TVDB REST API 发出 JSON POST 请求,但收到 CORS 错误

javascript - 全日历显示 "end date"休息一天

javascript - angularjs fullcalendar eventclick范围

css - 更改 TableView 中单个数据单元格的颜色

Excel:当内容由if语句确定时获取源单元格的单元格地址

javascript - 指示在 Angular 中选中的复选框

php - 每天显示的所有事件

iphone - iOS 5 Storyboard自定义单元格崩溃 : UITableView dataSource must return a cell