Closed pchristou closed 8 years ago
Got this sorted.
For the date handling part, I used:
var $input = $(this.el.nativeElement); // We grab a reference to the datepicker here
var picker = $input.pickadate('picker');
picker.on('close', function() {
//...
})
Are we able to use events callback already? Do anyone knows how to do it in Angular 2?
See here: https://github.com/InfomediaLtd/angular2-materialize/issues/283
<input materialize="pickadate" [materializeActions]="actions" type="text" />
this.actions.emit({action:"pickadate",params:["close"]});
Hi,
In short, I have 2 questions.
Longer explanation:
I understand Materialize uses pickadate.js under the covers. Having checked its API I see there are a range of event callbacks available:
How can I apply these to the datepicker in Angular 2? I got as far as grabbing the datepicker through
but there's not a great deal I can do from there. I actually want to close the datepicker on selection and found that an attribute 'closeOnSelect' exists: http://amsul.ca/pickadate.js/date/
Unfortunately, placing this in [materializeParams] doesn't seem to work.
One more thing, I noticed the Datepicker sample here http://angular2-materialize.surge.sh/#/datepicker does not suffer from this bug whereas Materializes (plus mine) does... can you think of any reasons why? I thought the implementation between both would be near identical...
As always, thank you! Pieris