Topic: Not able to set default values to Timepicker.
sreenathb@revature.com pro premium priority asked 6 years ago
<mdb-time-picker [(ngModel)]="schedule.openTime" [buttonLabel]="'Done'" [twelvehour]="true" [darktheme]="true" ></mdb-time-picker>Please provide a solution for it. Thanks.
Damian Gemza staff answered 6 years ago
<mdb-time-picker #time [buttonLabel]="'Done'" [(ngModel)]="schedule.open" [twelvehour]="true" [darktheme]="false" [placeholder]="'Selected time'" [label]="'Light version, 12hours'" [showClock]="true"></mdb-time-picker>
@ViewChild(ClockPickerComponent) time: ClockPickerComponent; schedule= { hours:'08', minutes:'00', ampm:'AM', open:'' }; ngAfterViewInit() { setTimeout(() => { this.schedule.open=this.schedule.hours+':'+this.schedule.minutes+this.schedule.ampm; this.time.selectedHours= { ampm:'AM', h:'08', m:'00' }; }, 0); }
sreenathb@revature.com pro premium priority commented 6 years ago
Thanks for the solution. It worked.david@shadowshot.systems answered 5 years ago
This doesn't appear to work anymore. While it does update the clock, it does not update the input field.
Arkadiusz Idzikowski staff commented 5 years ago
I already answered here: https://mdbootstrap.com/support/angular/how-to-set-initial-value-of-mdb-time-picker
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Angular
- MDB Version: 6.2.2
- Device: Desktop
- Browser: All
- OS: Windows
- Provided sample code: Yes
- Provided link: No