kevinoleary19 / Angular-2-Datepicker

A minimalist datepicker inspired by Google's material design
70 stars 71 forks source link

`(ngModelChange)` function not getting called on date change. #46

Open gansanz opened 7 years ago

gansanz commented 7 years ago

How can I call a component function when the date is changed?

cdtitus commented 7 years ago

<material-datepicker [(date)]="date" (onSelect)="yourFunctionHere">

cdtitus commented 7 years ago

<material-datepicker [(date)]="date" (dateChange)="yourFunctionHere">

zourtney commented 7 years ago

I've noticed that (dateChange) gets called on creation -- and twice after clicking a calendar day.

This was undesirable for my situation (Redux), so I'm now using the onSelect output:

<material-datepicker
  [(date)]="date"
  (onSelect)="yourFunctionHere"
></material-datepicker>