angularjs - 将 Angular 日历集成到 ionic 应用程序中不起作用

标签 angularjs calendar ionic-framework

您好,我正在尝试在 ionic 应用程序中使用以下日历

https://github.com/mattlewis92/angular-bootstrap-calendar

我的html

 <ion-view>
   <ion-content data-ng-controller="calenderController">
    {{tester}}
    <mwl-calendar view="calendarView"
        current-day="calendarDay"
        events="events"
        view-title="calendarTitle"
        on-event-click="eventClicked(calendarEvent)"
        edit-event-html="'<i class=\'glyphicon glyphicon-pencil\'></i>'"
        delete-event-html="'<i class=\'glyphicon glyphicon-remove\'></i>'"
        on-edit-event-click="eventEdited(calendarEvent)"
        on-delete-event-click="eventDeleted(calendarEvent)"
        auto-open="true">
    </mwl-calendar>
  </ion-content> 
</ion-view>

我的 Controller

angular.module('myApp.datescreen', ['mwl.calendar'])
  myApp.controller('calenderController', function($scope, $rootScope){
  $scope.calendarView = 'week';
  $scope.calendarDay =  new Date();
  $scope.tester = 'Is the Controller connecting';
  $scope.events = [
   {
    title: 'My event title', // The title of the event
    type: 'info', 
    startsAt: new Date(2013,5,1,1),
    endsAt: new Date(2014,8,26,15), 
    editable: false,
    deletable: false,
    incrementsBadgeTotal: true
   }
];

});

当我创建“tester”时,我可以看到 Controller 在页面上被点击,它渲染得很好,但对于日历来说,这是页面上显示的内容: “未设置传递给日历当前日期属性的值”

我可以看到 $scope.calendarDay 已设置,所以不知道出了什么问题

有人可以帮忙吗?

最佳答案

您需要包含 moment.js 才能正常工作。通过凉亭安装是不够的。请通过 html 页面上的 script 标签链接它。

注意:moment.js 的脚本标记应位于日历 js 文件的脚本标记之前

关于angularjs - 将 Angular 日历集成到 ionic 应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30422689/

相关文章:

javascript - 遍历对象或数组以确定元素是否在范围内

java - TimeZone 困扰着我的日期时间解析

android - 将事件添加到 Android 日历

jquery - 禁用日历中的所有日期

javascript - 无法从非 EcmaScript 模块导入命名导出 'Directive'(只有默认导出可用)

ionic-framework - 通过更新 google-services 插件的版本来解决版本冲突 | ionic

angularjs - Angular : difference when using template or templateUrl

html - for循环在angularjs中只运行一次

angularjs - md-autocomplete 未显示文本输入

javascript - 如何在angularjs中的选择选项中使用多选将json数据显示为optgroup