angularjs calendar

angularjs calendar

安装

bower install flex-calendar --savecd ../flex-calendar/..bower install

Add to index.html

<link rel="stylesheet" href="bower_components/flex-calendar.css"><script type="text/javascript" src="bower_components/angular-translate/angular-translate.min.js.js"></script><script type="text/javascript" src="bower_components/flex-calendar.js"></script>

Inject flex-calendar and pascalprecht.translate into your main module:

angular.module('App', ['flexcalendar' , 'pascalprecht.translate'])

Add </flex-calendar> directive to your html file.

<flex-calendar options="options" events="events"></flex-calendar>
Flex Calendar takes a few options:
app.controller('myController', ['$scope', function($scope) {
  "use strict";
  // With "use strict", Dates can be passed ONLY as strings (ISO format: YYYY-MM-DD)
  $scope.options = {
    defaultDate: "2015-08-06",
    minDate: "2015-01-01",
    maxDate: "2015-12-31",
    disabledDates: [
        "2015-06-22",
        "2015-07-27",
        "2015-08-13",
        "2015-08-15"
    ],
    dayNamesLength: 1, // 1 for "M", 2 for "Mo", 3 for "Mon"; 9 will show full day names. Default is 1.
    mondayIsFirstDay: true,//set monday as first day of week. Default is false
    eventClick: function(date) {
      console.log(date);
    },
    dateClick: function(date) {
      console.log(date);
    },
    changeMonth: function(month, year) {
      console.log(month, year);
    },
  };

  $scope.events = [
    {foo: 'bar', date: "2015-08-18"},
    {foo: 'bar', date: "2015-08-20"}
  ];
}]);
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Why use AngularJS1). It uses MVC to let you split app int...
    咕嘿嘿DAZE阅读 4,196评论 0 0
  • Ionic-Demos Ionic Ionic 的介绍请看官网, 还有Ionichina(一个Ionic中文论坛)...
    SamDing阅读 8,448评论 0 5
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,484评论 0 23
  • This project was bootstrapped with Create React App. Belo...
    unspecx阅读 10,597评论 0 2
  • 下午和妈妈去种棉花了。棉花是妈妈提前秧在废弃的瓶瓶罐罐里的,已经长成小苗了,妈妈说刚好移栽到地里。姐姐出嫁的时候,...
    关妹妹阅读 3,480评论 0 1