Topic: Data structure incomplete for timepicker?
Starceaker free asked 7 years ago
Dear MDB
On the following page I see ngModel being bound to properties that are not mentioned in the datastructure section:
https://mdbootstrap.com/angular/advanced/timepicker/#options
While testing your timepicker I notice that the initial value I give my string property (for example: 15:00) is not taken into account when opening the timepicker. It shows 12:00 as a first selection. After that the selection is correctly shown when opening the timepicker.
Dawid Adach pro answered 7 years ago
Within your component.ts file import import { Component, OnInit, ViewChild, AfterViewInit} from '@angular/core';
then, initialize variable i.e.: @ViewChild("darkPicker") darkPicker: ClockPickerComponent;make sure to add darkPicker id to you html element like this:
<mdb-time-picker #darkPicker [twelvehour]="false" [darktheme]="true" [placeholder]="'Selected time'" [label]="'Dark version, 24hours'" [ngModel]="darkClock"></mdb-time-picker>Finally, you can user .setHour and .setMinute and .setAmPm functions to set your time.
ngAfterViewInit(){ setTimeout(() => this.darkPicker.setHour("15"), 0); }
Starceaker free answered 7 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Rafał Rogulski free commented 7 years ago
Thanks, for report this bug we will fix it in next release.