Last active
March 14, 2017 10:32
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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