ember-flatpickr icon indicating copy to clipboard operation
ember-flatpickr copied to clipboard

implementation of the monthselect plugin in ember flatpicker in ember

Open asmaaEbed95 opened this issue 4 years ago • 1 comments

i tried to implement the plugin inside my project as i can not implement it in the hbs file and it cannot pass it's parameters to the js file in the .hbs file the code as follows:

<EmberFlatpickr
  @plugins=plugins />

in the .js file:

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

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

in ember-cli-build.js file:

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

asmaaEbed95 avatar Nov 18 '20 10:11 asmaaEbed95

@asmaaEbed95 we may need to add plugins here https://github.com/shipshapecode/ember-flatpickr/blob/master/addon/components/ember-flatpickr.js#L114 I've never used plugins, and I don't really know.

RobbieTheWagner avatar Nov 19 '20 13:11 RobbieTheWagner

It think this issue can be closed.

The approach works nowadays.

 <EmberFlatpickr
      @date={{this.date}}
      @onChange{{on "change" (pick "target.value" this.handler))}}
      @plugins={{array this.monthSelect}}
    />

all the arugments to EmberFlatpickr are collected via ...rest and passed to the constructor. :+1:

derrabauke avatar Mar 07 '23 07:03 derrabauke

@derrabauke perhaps we should document this though?

RobbieTheWagner avatar Mar 07 '23 17:03 RobbieTheWagner