Maryna
Maryna

Reputation: 231

Value change for Ng Date Time Picker doesn't work

Nothing of events are not working for ng-pick-datetime

<label class="fieldlabel">{{ attribute.attribute.displayName }}: </label>
<label>
  <mat-form-field class="field-full-width">
    <input [owlDateTimeTrigger]="datePicker" placeholder="Date" [owlDateTime]="datePicker"
  [dateTimeInput]="emitValue()" [(ngModel)]="value.value">
    <owl-date-time #datePicker></owl-date-time>
 </mat-form-field>
</label>    

Also I import needed modules:

import { OwlDateTimeModule, OwlNativeDateTimeModule } from 'ng-pick-datetime';

https://www.npmjs.com/package/ng-pick-datetime enter image description here

I have the same errors for other events: afterPickerOpen,
yearSelected, monthSelected, dateTimeChange

Upvotes: 8

Views: 8435

Answers (1)

Kim Kern
Kim Kern

Reputation: 60357

dateTimeInput is an output (event) not an input. Hence, you need to use () instead of [].

(dateTimeInput)="emitValue()"

For further information on outputs, read the official Angular docs.

Upvotes: 8

Related Questions