简体   繁体   中英

angular bootstrap calendar not displaying

I am trying to use the angular bootstrap calendar in my apache cordova app

HTML:

            <ion-view>
                <ion-content has-header="true" padding="true" ng-app="app" data-ng-controller="calendarController">
                    {{test}}
                    <mwl-calendar view="calendarView"
                      current-day="calendarDay"
                      events="events">
                </mwl-calendar>
                </ion-content>
            </ion-view>

Controller:

.controller('calendarController', ['$scope', '$state', 'moment', function ($scope, $state, moment) {

$scope.test = 'Test the controller';
$scope.calendarView = 'week';
$scope.calendarDay = new Date();
$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
 }
];
}]);

I have included the links to the relevant dependencies including moment.js however I get a message 'the value passed to current day attribute is not set'. I have made sure moment.js is linked before the main app.js file which contains the controller as suggested in a similar question but I still get the same message. I am new to angular and would appreciate any help that anyone can offer.

If you are using angular boostrap calendar, you need to know that some attribute are mandatory.

I don't see any view-date attribute define in your html file. Instead of

 current-day="calendarDay"

try:

 view-date="calendarDay"

You can check the README file of the official project for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM