pikaday-angular icon indicating copy to clipboard operation
pikaday-angular copied to clipboard

Clear model data

Open pedalpete opened this issue 8 years ago • 1 comments

Great little directive, but I'm having trouble clearing the date field (I'll admit, I've been away from Angular for a bit, but thought this would be easy).

<input pikaday="filterCtrl.filter.fromDate" on-select="filterCtrl.selectDate(pikaday,'fromDate')" />

I thought pikaday would clear if I set filterCtrl.filter.fromDate = null but the text is still in the input field.

I don't see anywhere in your code to clear. Is this possible? Or do I need to just go get the element and clear it?

pedalpete avatar May 05 '16 06:05 pedalpete

@pedalpete You need to use the setDate method with a value of null. That will reset the pikaday date and input field value.

filterCtrl.filter.setDate(null)

christrotter89 avatar Dec 06 '16 19:12 christrotter89