I am on Angular 2.4 and trying to use PrimeNG schedule, but I am getting errors. If you go to the following link, you will see an example of a schedule and documentation, if you scroll down the page:
http://www.primefaces.org/primeng/#/schedule
I followed this documentation (with the only difference being that I changed "MyModel" to "CalendarComponent"), but got the following error:
The error in calendar.component.html: 0: 0 caused by: this.schedule.fullCalendar is not a function
Is it because I need to install and import FullCalendar? I figured it could be so, but when I tried to import it, I got the following 404:
https: // localhost: 44301 / node_modules / fullcalendar / fullcalendar 404 ()
Here is my code after trying to import FullCalendar ...
app.module.ts:
...
import { FullCalendar } from 'fullcalendar/fullcalendar';
import { ScheduleModule } from 'primeng/primeng';
import { CalendarComponent } from './calendar.component';
...
imports: [
...
FullCalendar,
ScheduleModule
],
declarations: [
...
CalendarComponent
],
...
calendar.component.ts:
...
export class CalendarComponent implements OnInit {
events: any[];
headerConfig: any;
public constructor(
...
) { }
ngOnInit(): void {
this.events = [
{
"title": "All Day Event",
"start": "2016-01-01"
},
{
"title": "Long Event",
"start": "2016-01-07",
"end": "2016-01-10"
},
{
"title": "Repeating Event",
"start": "2016-01-09T16:00:00"
},
{
"title": "Repeating Event",
"start": "2016-01-16T16:00:00"
},
{
"title": "Conference",
"start": "2016-01-11",
"end": "2016-01-13"
}
];
this.headerConfig = {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
};
}
handleEventClick(e:any) {
console.log('Selected event: ' + e.event);
console.log('Browser click event: ' + e.jsEvent);
console.log('Current view object: ' + e.view);
}
}
calendar.component.html:
<p-schedule [events]="events" [header]="headerConfig" (onEventClick)="handleEventClick($event)"></p-schedule>
systemjs.config.js:
map: {
...
'fullcalendar': 'npm:fullcalendar',
'primeng': 'npm:primeng'
},
package.json:
"dependencies": {
...
"fullcalendar": "^3.1.0",
"primeng": "^1.1.4",
},