Topic: mdb-time-picker - execute code upon selecting time

getitdonefitness free asked 5 years ago


hi, I want to be able to execute code upon a user picking the time and clicking the "done" button. I was not able to see anything on the docs regarding this. How would I do this?


Damian Gemza staff answered 5 years ago


Dear getitdonefitness,

Thanks for your report.

For now, there's no such possibility to achieve desired functionality with our API.

But you'll able to use [(ngModel)] and (ngModelChange) to detect, if Time Picker input value has changed (change is emitted after clicking a Done button).

Please take a look at below code:

.html:

<div class="row">
  <div class="col-md-6 mx-auto my-5">
    <mdb-time-picker [buttonLabel]="'Done'" [(ngModel)]="value" (ngModelChange)="onDateChange($event)" [twelvehour]="true" [darktheme]="false" [placeholder]="'Selected time'" [label]="'Light version, 12hours'" [showClock]="true" [ngModel]="lightClock"></mdb-time-picker>
  </div>
</div>

.ts:

import {Component} from '@angular/core';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
value: string = '';
  onDateChange(event: any) {
    console.log(event);
  }
}

We'll add this feature, but not now - you have to give us some time.

Best Regards, Damian


getitdonefitness free answered 5 years ago


thanks for the work around



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.4.1
  • Device: laptop
  • Browser: chrome
  • OS: mac
  • Provided sample code: No
  • Provided link: No