【问题标题】:not use an angular2-fullcalendar不使用 angular2-fullcalendar
【发布时间】:2017-04-09 18:09:26
【问题描述】:

我提到了https://www.npmjs.com/package/angular2-fullcalendar。 但是,它不会正确显示。 仅显示日历的标题部分。 哪里错了?

npm install ap-angular2-fullcalendar --save

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';
import {CalendarComponent} from "ap-angular2-fullcalendar";

@NgModule({
  declarations: [
    AppComponent,
    CalendarComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

style.css

@import "../node_modules/fullcalendar/dist/fullcalendar.min.css";

app.component.html

<angular2-fullcalendar [options]="calendarOptions"></angular2-fullcalendar>

app.component.ts

import {Component, ViewChild} from '@angular/core';
import {CalendarComponent} from "ap-angular2-fullcalendar";

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app works!';


  @ViewChild(CalendarComponent) myCalendar: CalendarComponent;

  changeCalendarView(view) {
    this.myCalendar.fullCalendar('changeView', view);
  }

  calendarOptions:Object = {
    height: 'parent',
    fixedWeekCount : false,
    defaultDate: '2016-09-12',
    editable: true,
    eventLimit: true, // allow "more" link when too many events
    events: [
      {
        title: 'All Day Event',
        start: '2016-09-01'
      },
      {
        title: 'Long Event',
        start: '2016-09-07',
        end: '2016-09-10'
      },
      {
        id: 999,
        title: 'Repeating Event',
        start: '2016-09-09T16:00:00'
      },
      {
        id: 999,
        title: 'Repeating Event',
        start: '2016-09-16T16:00:00'
      },
      {
        title: 'Conference',
        start: '2016-09-11',
        end: '2016-09-13'
      },
      {
        title: 'Click for Google',
        url: 'http://google.com/',
        start: '2016-09-28'
      }
    ]
  };

}

enter image description here

【问题讨论】:

  • 您是否在控制台中遇到任何错误?
  • 我看到了浏览器控制台。那里没有错误。
  • 好的,找到了问题..从您的选项中删除 height:parent

标签: angular npm


【解决方案1】:

以某种方式在选项中使用 height:parent 配置将日历正文的高度设置为 0,因此您需要将其注释掉才能查看日历。

【讨论】:

  • 因为日文资料不够,所以很有帮助。将来,我会制作有关日语的信息,以免其他日本人遇到与我相同的问题。非常感谢。 qiita.com/kuniatsu/items/203d5d17194b0befb189
  • 抱歉这是什么?编辑:稍后阅读您编辑的评论..很棒的工作
  • 我用我教你的东西做了日语。非常感谢。
猜你喜欢
  • 2017-11-23
  • 1970-01-01
  • 1970-01-01
  • 2017-07-17
  • 1970-01-01
  • 2017-08-18
  • 2017-04-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多