Convert Figma logo to code with AI

angular-ui logoui-calendar

A complete AngularJS directive for the Arshaw FullCalendar.

1,491
729
1,491
223

Top Related Projects

Full-sized drag & drop event calendar in JavaScript

5,385

UI Grid: an Angular Data Grid

16,546

Material design for AngularJS

CLI tool for Angular

Component infrastructure and Material Design components for Angular

Angular powered Bootstrap

Quick Overview

UI-Calendar is an AngularJS directive for the FullCalendar jQuery plugin. It provides a flexible and customizable calendar component for AngularJS applications, allowing developers to easily integrate event management and scheduling features into their projects.

Pros

  • Seamless integration with AngularJS applications
  • Extensive customization options for calendar appearance and behavior
  • Support for various calendar views (month, week, day)
  • Easy event management and manipulation

Cons

  • Dependent on jQuery and FullCalendar library
  • Limited documentation and examples
  • Not actively maintained (last update was in 2017)
  • May not be compatible with newer versions of AngularJS or Angular

Code Examples

  1. Basic calendar initialization:
$scope.eventSources = [];
$scope.uiConfig = {
  calendar:{
    height: 450,
    editable: true,
    header:{
      left: 'month basicWeek basicDay',
      center: 'title',
      right: 'today prev,next'
    }
  }
};
  1. Adding events to the calendar:
$scope.events = [
  {title: 'Event 1', start: new Date()},
  {title: 'Event 2', start: new Date(2023, 5, 15), end: new Date(2023, 5, 17)}
];
$scope.eventSources = [$scope.events];
  1. Handling event clicks:
$scope.uiConfig = {
  calendar:{
    eventClick: function(event) {
      $scope.alertMessage = (event.title + ' was clicked ');
    }
  }
};

Getting Started

  1. Install the ui-calendar package:

    bower install angular-ui-calendar
    
  2. Include the necessary files in your HTML:

    <link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css"/>
    <script src="bower_components/jquery/dist/jquery.min.js"></script>
    <script src="bower_components/angular/angular.min.js"></script>
    <script src="bower_components/moment/min/moment.min.js"></script>
    <script src="bower_components/fullcalendar/dist/fullcalendar.min.js"></script>
    <script src="bower_components/angular-ui-calendar/src/calendar.js"></script>
    
  3. Add the module dependency to your AngularJS app:

    angular.module('myApp', ['ui.calendar']);
    
  4. Use the directive in your HTML:

    <div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>
    

Competitor Comparisons

Full-sized drag & drop event calendar in JavaScript

Pros of fullcalendar

  • More comprehensive and feature-rich calendar solution
  • Regular updates and active maintenance
  • Extensive documentation and community support

Cons of fullcalendar

  • Steeper learning curve due to more complex API
  • Requires additional setup for Angular integration

Code Comparison

ui-calendar:

<div ui-calendar="calendarOptions" ng-model="eventSources"></div>

fullcalendar:

<full-calendar [options]="calendarOptions"></full-calendar>

Key Differences

  • ui-calendar is specifically designed for AngularJS, while fullcalendar is framework-agnostic but can be integrated with Angular
  • fullcalendar offers more customization options and plugins
  • ui-calendar has a simpler API, making it easier to get started for basic use cases

Performance

  • fullcalendar generally offers better performance, especially for large datasets
  • ui-calendar may have performance issues with complex configurations or large numbers of events

Community and Support

  • fullcalendar has a larger and more active community
  • More third-party resources and tutorials available for fullcalendar

Integration

  • ui-calendar integrates seamlessly with AngularJS projects
  • fullcalendar requires additional wrapper components for Angular integration but offers more flexibility for use with other frameworks
5,385

UI Grid: an Angular Data Grid

Pros of ui-grid

  • More comprehensive data grid solution with advanced features like sorting, filtering, and pagination
  • Better performance for handling large datasets
  • More active development and community support

Cons of ui-grid

  • Steeper learning curve due to its complexity
  • Heavier and may impact page load times
  • Less flexibility for customization compared to simpler calendar components

Code Comparison

ui-grid:

<div ui-grid="gridOptions" class="myGrid"></div>
$scope.gridOptions = {
  enableSorting: true,
  columnDefs: [
    { field: 'name' },
    { field: 'age', type: 'number' }
  ],
  data: [/* ... */]
};

ui-calendar:

<div ui-calendar="calendarOptions" ng-model="eventSources"></div>
$scope.calendarOptions = {
  editable: true,
  header: {
    left: 'month basicWeek basicDay agendaWeek agendaDay',
    center: 'title',
    right: 'today prev,next'
  }
};

Summary

ui-grid is a more powerful and feature-rich solution for displaying tabular data, while ui-calendar focuses specifically on calendar functionality. ui-grid offers better performance for large datasets but comes with increased complexity. ui-calendar provides a simpler implementation for calendar-specific use cases but may lack advanced data handling capabilities. The choice between the two depends on the specific requirements of your project and the type of data you need to display.

16,546

Material design for AngularJS

Pros of Material

  • Comprehensive UI component library with a wide range of pre-built elements
  • Follows Material Design principles, ensuring a modern and consistent look
  • Actively maintained by the Angular team with frequent updates

Cons of Material

  • Larger bundle size due to the extensive component library
  • Steeper learning curve for developers new to Material Design concepts
  • May require additional customization to fit specific design requirements

Code Comparison

ui-calendar:

<ui-calendar ng-model="eventSources" calendar="myCalendar"></ui-calendar>

Material:

<mat-calendar [selected]="selectedDate" (selectedChange)="onDateSelected($event)">
</mat-calendar>

Key Differences

  • ui-calendar focuses specifically on calendar functionality, while Material provides a broader set of UI components
  • Material offers a more modern and visually appealing design out of the box
  • ui-calendar may be easier to integrate for simple calendar needs, while Material requires more setup but provides greater flexibility

Use Cases

  • Choose ui-calendar for projects that primarily need a calendar component with minimal additional UI requirements
  • Opt for Material when building a comprehensive Angular application that benefits from a consistent design system and a wide range of UI components

CLI tool for Angular

Pros of angular-cli

  • Comprehensive tooling for Angular development, including project scaffolding, build optimization, and testing
  • Active development and maintenance by the Angular team
  • Extensive documentation and community support

Cons of angular-cli

  • Steeper learning curve for beginners
  • More complex setup compared to simpler UI components
  • Larger project footprint and potential overhead for small applications

Code Comparison

ui-calendar:

angular.module('myApp', ['ui.calendar'])
  .controller('CalendarCtrl', function($scope) {
    $scope.eventSources = [];
  });

angular-cli:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent { }

Summary

ui-calendar is a specific UI component for calendars in AngularJS, while angular-cli is a comprehensive command-line interface for developing Angular applications. angular-cli offers more extensive features for full-scale Angular development but may be overkill for simple UI components. ui-calendar is more focused and easier to integrate for calendar functionality but lacks the broader development tools provided by angular-cli.

Component infrastructure and Material Design components for Angular

Pros of components

  • More comprehensive set of UI components beyond just calendars
  • Actively maintained with frequent updates and bug fixes
  • Better integration with modern Angular versions

Cons of components

  • Steeper learning curve due to more complex architecture
  • Potentially heavier bundle size if using multiple components

Code Comparison

ui-calendar:

<div ui-calendar="calendarOptions" ng-model="eventSources"></div>

components:

<mat-calendar [selected]="selectedDate" (selectedChange)="onSelect($event)">
</mat-calendar>

Summary

components offers a more extensive set of UI components and is actively maintained, making it a better choice for modern Angular applications. However, it may have a steeper learning curve and potentially larger bundle size compared to ui-calendar.

ui-calendar is simpler to implement for basic calendar functionality but lacks the breadth of features and ongoing support that components provides.

The code comparison shows that ui-calendar uses a directive approach with options passed as attributes, while components uses a more declarative component-based syntax with Angular's property and event binding.

Angular powered Bootstrap

Pros of ng-bootstrap

  • Native Angular implementation, providing better integration and performance
  • Regularly updated with new features and bug fixes
  • Comprehensive documentation and examples

Cons of ng-bootstrap

  • Limited to Bootstrap components, less flexibility for custom designs
  • Steeper learning curve for developers unfamiliar with Bootstrap

Code Comparison

ui-calendar:

<ui-calendar ng-model="eventSources" calendar="myCalendar"></ui-calendar>

ng-bootstrap:

<ngb-datepicker [(ngModel)]="model" (navigate)="date = $event.next"></ngb-datepicker>

Key Differences

  • ui-calendar focuses specifically on calendar functionality, while ng-bootstrap provides a wide range of UI components
  • ng-bootstrap is built natively for Angular, whereas ui-calendar is an AngularJS plugin
  • ui-calendar requires additional dependencies like jQuery and FullCalendar, while ng-bootstrap is self-contained

Use Cases

  • Choose ui-calendar for projects requiring advanced calendar features
  • Opt for ng-bootstrap when building a comprehensive Angular application with Bootstrap-style components

Community and Support

  • ng-bootstrap has a larger community and more frequent updates
  • ui-calendar has a smaller, more specialized user base

Integration

  • ng-bootstrap seamlessly integrates with Angular projects
  • ui-calendar may require additional configuration for modern Angular applications

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

ui-calendar directive Build Status

Join the chat at https://gitter.im/angular-ui/ui-calendar

A complete AngularJS directive for the Arshaw FullCalendar.

Requirements

Usage

Using bower run:

bower install --save angular-ui-calendar

Alternatively you can add it to your bower.json like this:

dependencies: {
    "angular-ui-calendar": "latest"
}

And then run

bower install

This will copy the ui-calendar files into your components folder, along with its dependencies. Load the script and style files in your application:

<link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css"/>
<!-- jquery, moment, and angular have to get included before fullcalendar -->
<script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="bower_components/moment/min/moment.min.js"></script>
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="bower_components/angular-ui-calendar/src/calendar.js"></script>
<script type="text/javascript" src="bower_components/fullcalendar/dist/fullcalendar.min.js"></script>
<script type="text/javascript" src="bower_components/fullcalendar/dist/gcal.js"></script>

Add the calendar module as a dependency to your application module:

var app = angular.module('App', ['ui.calendar'])

Apply the directive to your div elements. The calendar must be supplied an array of documented event sources to render itself:

<div ui-calendar ng-model="eventSources"></div>

Define your model in a scope e.g.

$scope.eventSources = [];

Options

All the Arshaw Fullcalendar options can be passed through the directive. This even means function objects that are declared on the scope.

myAppModule.controller('MyController', function($scope) {
    /* config object */
    $scope.uiConfig = {
      calendar:{
        height: 450,
        editable: true,
        header:{
          left: 'month basicWeek basicDay agendaWeek agendaDay',
          center: 'title',
          right: 'today prev,next'
        },
        eventClick: $scope.alertEventOnClick,
        eventDrop: $scope.alertOnDrop,
        eventResize: $scope.alertOnResize
      }
    };
});

<div ui-calendar="uiConfig.calendar" ng-model="eventSources">

Working with ng-model

The ui-calendar directive plays nicely with ng-model.

An Event Sources object needs to be created to pass into ng-model. This object's values will be watched for changes. If a change occurs, then that specific calendar will call the appropriate fullCalendar method.

The ui-calendar directive expects the eventSources object to be any type allowed in the documentation for the fullcalendar. docs Note that all calendar options which are functions that are passed into the calendar are wrapped in an apply automatically.

Accessing the calendar object

It is possible to access a specific calendar object by declaring a name for it on the uiCalendar directive. In this next line we are naming the calendar 'myCalendar'. This will be attached to the uiCalendarConfig constant object, that can be accessed via DI.

<div ui-calendar="calendarOptions" ng-model="eventSources" calendar="myCalendar">

Now the calendar object is available in uiCalendarConfig.calendars:

uiCalendarConfig.calendars.myCalendar

This allows you to declare any number of calendar objects with distinct names.

Custom event rendering

You can use fullcalendar's eventRender option to customize how events are rendered in the calendar. However, only certain event attributes are watched for changes (they are id, title, url, start, end, allDay, and className).

If you need to automatically re-render other event data, you can use calendar-watch-event. calendar-watch-event expression must return a function that is passed event as argument and returns a string or a number, for example:

$scope.extraEventSignature = function(event) {
   returns "" + event.price;
}

<ui-calendar calendar-watch-event="extraEventSignature(event)" ... >
// will now watch for price

Adding new events issue

When adding new events to the calendar they can disappear when switching months. To solve this add stick: true to the event object being added to the scope.

Watching the displayed date range of the calendar

There is no mechanism to $watch the displayed date range on the calendar due to the JQuery nature of fullCalendar. If you want to track the dates displayed on the calendar so you can fetch events outside the scope of fullCalendar (Say from a caching store in a service, instead of letting fullCalendar pull them via AJAX), you can add the viewRender callback to the calendar config.

$scope.calendarConfig = {
    calendar:{
        height: "100%",
        ...
        viewRender: function(view, element) {
            $log.debug("View Changed: ", view.visStart, view.visEnd, view.start, view.end);
        }
    }
};

Minify

grunt minify

Local Server to test demo

grunt serve

Documentation for the Calendar

The calendar works alongside of all the documentation represented here

PR's R always Welcome

Make sure that if a new feature is added, that the proper tests are created.

Testing

We use karma and grunt to ensure the quality of the code.

npm install -g grunt-cli
npm install
bower install
grunt

NPM DownloadsLast 30 Days