Skip to content

Instantly share code, notes, and snippets.

@cs3b
Last active March 14, 2017 10:32
Show Gist options
  • Select an option

  • Save cs3b/f64bb941c9192c9ae45a14fb8b9b057d to your computer and use it in GitHub Desktop.

Select an option

Save cs3b/f64bb941c9192c9ae45a14fb8b9b057d to your computer and use it in GitHub Desktop.
ember-pickaday to paper-pickaday step by step implementation (ember-paper pickaday google material design)
import Ember from 'ember';
import PikadayMixin from 'ember-pikaday/mixins/pikaday';
import PaperInput from 'ember-paper/components/paper-input';
import layout from 'ember-paper/templates/components/paper-input';
export default PaperInput.extend(PikadayMixin, {
layout,
format: 'YYYY-MM-DD',
didInsertElement() {
this._super(...arguments);
this.set('field', this.element.children[1]);
this.setupPikaday();
},
onPikadayOpen: function() {
this.get('onOpen')();
},
onPikadayClose: function() {
if (this.get('pikaday').getDate() === null || Ember.isEmpty(this.$().val())) {
this.set('value', null);
this.get('onSelection')(null);
}
this.get('onClose')();
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment