ion-datepicker
ion-datepicker copied to clipboard
Issue : Model not opening and min & max dates
Hi @MishaSen,
I'm using this datepicker for my project. It is working for any new or demo project but while integrating with my existing project, it is showing error like below.
I followed your coding as it is in demo folder. And I installed all peerDependencies as you mentioned in package.json
But is showing as below.
Error:
Error: Template parse errors: Can't bind to 'min' since it isn't a known property of 'span'. ("-col col-1> <span ion-datepicker [(ngModel)]="initDate" locale="en-US" [ERROR ->][min]='minDate' [max]='maxDate' clear class="ScheduleDate"> {{init"): ng:///AddmodifyproductstepsPageModule/datepickerpage.html@1472:87
Can't bind to 'max' since it isn't a known property of 'span'. ("<span ion-datepicker [(ngModel)]="initDate" locale="en-US" [min]='minDate' [ERROR ->][max]='maxDate' clear class="ScheduleDate"> {{initDate | date}}<io"): ng:///AddmodifyproductstepsPageModule/datepickerpage.html@1472:103
My datepickerpage.html code:
My datepickerpage.ts code: import { DatePickerDirective } from "ion-datepicker"; @ViewChild(DatePickerDirective) public datepicker: DatePickerDirective; public localDate: Date = new Date(); public initDate: Date = new Date(); public initDate2: Date = new Date(2015, 1, 1); public minDate: Date = new Date(2017, 12, 31); public maxDate: Date = new Date(2100, 12, 31); public disabledDates: Date[] = [new Date(2017, 7, 14)]; public localeString = { monday: true, weekdays: ['Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo'], months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'] }; public min: Date = new Date(); constructor(public navCtrl: NavController,public actionsheetCtrl:ActionSheetController, private viewCtrl: ViewController,public navParams: NavParams,public loadingCtrl: LoadingController, public plt:Platform, private alertCtrl: AlertController, public toastCtrl: ToastController, public ServicesService: ServicesService, public Camera: Camera) { } public ngOnInit() { } public Log(stuff): void { this.datepicker.open(); this.datepicker.changed.subscribe(() => console.log('test')); console.log(stuff); }
public event(data: Date): void { this.localDate = data; } setDate(date: Date) { console.log(date); this.initDate = date; }
app.module.ts code:
*********;
*********;
import { DatePickerModule } from "ion-datepicker";
declarations: [
MyApp,
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
RouterModule,
RouterModule.forRoot(AppRoutes),
IonicModule.forRoot(MyApp, { scrollAssist: false, autoFocusAssist: false } ),
SuperTabsModule.forRoot(),
DatePickerModule,
DatepickerPage,
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
providers: [
StatusBar,
ServicesService,
AdminServices,
Config,
Enums,
ScreenOrientation,
SplashScreen,
Geolocation,
Camera,
Device,
AndroidPermissions,
{provide: ErrorHandler, useClass: IonicErrorHandler}
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
],
@misha130, Please help me
Please help me anyone,
If you help me i ll be honored.
Thanks
Add DatePickerModule to AddmodifyproductstepsPageModule