RobbieTheWagner / ember-flatpickr

An Ember addon that wraps the Flatpickr date picker
https://RobbieTheWagner.github.io/ember-flatpickr/
MIT License
109 stars 55 forks source link

Add documentation about how to use plugins #352

Open Gorzas opened 5 years ago

Gorzas commented 5 years ago

I'm currently working with ember-flatpickr and using the week select plugin. As I tested, you currently can use plugins with this library but I think it should be documented.

We could use the plugin the following way:

{{ember-flatpickr
  plugins=plugins
}}

And having the controller like this:

import Controller from '@ember/controller';
import weekSelect from 'flatpickr/dist/plugins/weekSelect/weekSelect';

export default Controller.extend({
    plugins: [new weekSelect()],
});

What do you think?

RobbieTheWagner commented 5 years ago

@Gorzas I think that is fine, but I think the idea is you can pass any options flatpickr supports.

gzurbach commented 4 years ago

@Gorzas for some reason your solution did not work for me...

I had to add this line to my ember-cli-build.js file:

app.import('node_modules/flatpickr/dist/plugins/rangePlugin.js');

I'm using Ember 3.4 with ember-auto-import installed 🤷‍♂️

RobbieTheWagner commented 4 years ago

@gzurbach probably because we don't import any plugins in the addon https://github.com/shipshapecode/ember-flatpickr/blob/master/index.js#L16

I haven't tried using plugins myself, so I am not sure how to better support this.