我试图实现我的离子3项目的日历

时间:2017-09-29 20:59:59

标签: angular typescript calendar ionic3

我正在尝试为我的离子3项目实施日历,但我一直收到此错误

createInstance()

这是我的app.module

ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'type' since it isn't a known property of 'ion-calendar'.

这是我的HTML

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';

import { MyApp } from './app.component';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { CalendarModule } from "ion2-calendar";
@NgModule({
    declarations: [
     MyApp,
     ],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpModule,
CalendarModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
 providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}

这是我对html页面的看法

<ion-content padding>
<ion-calendar [(ngModel)]="date"
(onChange)="onChange($event)"
[type]="type"
[format]="'YYYY-MM-DD'">
</ion-calendar>

有什么想法吗?我已经安装了import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; @IonicPage() @Component({ selector: 'page-calendar', templateUrl: 'calendar.html', }) export class CalendarPage { date: string; type: 'string'; // 'string' | 'js-date' | 'moment' | 'time' | 'object' constructor(public navCtrl: NavController, public navParams: NavParams) { } onChange($event) { console.log($event); } ionViewDidLoad() { console.log('ionViewDidLoad CalendarPage'); } } 所有的帮助都是预先确定的 有人告诉我,这可能是离子3的延迟负荷

1 个答案:

答案 0 :(得分:0)

您需要import CalendarComponentOptions课程,如下所示。

calendar.ts

import { CalendarComponentOptions } from 'ion2-calendar'