Loader无法在FullCalendar插件中运行

时间:2016-08-25 06:44:35

标签: jquery angularjs

我正在使用AngularJs的FullCalendar(http://fullcalendar.io/)插件我需要在数据加载到日历时显示加载程序。我正在使用加载触发器来显示加载器

$scope.uiConfig = {loading: $scope.loading}
$scope.loading = function( isLoading, view ) {
          if(isLoading) {// isLoading gives boolean value
              $('#loading').show();
          } else {
              $('#loading').hide();
          }
        }

解释它是如何运作的

1 个答案:

答案 0 :(得分:2)

当事件提取开始/停止时,会触发fullcalendar的loading回调。

function( isLoading, view ){} //isLoading is true when events fetching //is started else false when done

JS CODE:

$('#calendar').fullCalendar({
  header: {
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
  },
  year: 2010,
  month: 0, // January
  editable: true,
  events: '/gh/gist/response.json/6218404/',
  loading: function( isLoading, view ) {
      if(isLoading) {// isLoading gives boolean value
          $('#wait').show();
      } else {
          $('#wait').hide();
      }
  }
});

Working demo @ JSFiddle

参考文献: