soulim / ember-cli-bootstrap-datepicker

Datepicker component for Ember CLI
http://sul.im/ember-cli-bootstrap-datepicker
MIT License
67 stars 57 forks source link

Pass parameter to action? #74

Open IntellectProductions opened 8 years ago

IntellectProductions commented 8 years ago

Is there anyway to pass a parameter to the action hooks on this component?

Right now, I have this:

{{bootstrap-datepicker value=model.purchase_date format='mm/dd/yyyy' name='purchase_date' class='form-control' id='purchase_date' changeDate='calculateNextAppt'}}

But I need to be able to pass a parameter to this action method.. is there a way to do so in this component?

Thank you.

NicholasJohn16 commented 8 years ago

You could try using the action helper like this:

{{bootstrap-datepicker changeDate=(action 'calculateNextAppt' 'parameter')}}

Then the action function would be like this:

actions: {
  calculateNextAppt(date, parameter) {
    // do sth with the new date
  }
}