Bre*_*ett 5 fullcalendar primeng angular
我在Angular 2.4上,我正在尝试使用PrimeNG的时间表,但我遇到了错误.如果您转到以下链接,您将看到计划的示例,如果向下滚动页面,还会看到文档:
http://www.primefaces.org/primeng/#/schedule
我遵循该文档(唯一的区别是我将"MyModel"更改为"CalendarComponent"),但是出现以下错误:
calendar.component.html:0:0引起的错误:this.schedule.fullCalendar不是函数
这是因为我需要安装和导入FullCalendar吗?我想可能是这种情况,但当我尝试导入它时,我得到了以下404:
https:// localhost:44301/node_modules/fullcalendar/fullcalendar 404()
尝试导入FullCalendar后,这是我的代码...
app.module.ts:
...
import { FullCalendar } from 'fullcalendar/fullcalendar';
import { ScheduleModule } from 'primeng/primeng';
import { CalendarComponent } from './calendar.component';
...
imports: [
...
FullCalendar,
ScheduleModule
],
declarations: [
...
CalendarComponent
],
...
Run Code Online (Sandbox Code Playgroud)
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) {
//e.event = Selected event
//e.jsEvent = Browser click event
//e.view = Current view object
console.log('Selected event: ' + e.event);
console.log('Browser click event: ' + e.jsEvent);
console.log('Current view object: ' + e.view);
}
}
Run Code Online (Sandbox Code Playgroud)
calendar.component.html:
<p-schedule [events]="events" [header]="headerConfig" (onEventClick)="handleEventClick($event)"></p-schedule>
Run Code Online (Sandbox Code Playgroud)
systemjs.config.js:
map: {
...
'fullcalendar': 'npm:fullcalendar',
'primeng': 'npm:primeng'
},
Run Code Online (Sandbox Code Playgroud)
的package.json:
"dependencies": {
...
"fullcalendar": "^3.1.0",
"primeng": "^1.1.4",
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7586 次 |
| 最近记录: |