@belgoros wrote:
I tried to use
sendAction
to call another route action from component like that:# components/holiday-hour.js actions: { ... deleteHoliday(holiday) { this.sendAction('deleteHoliday', holiday); }, }
I have
deleteHoliday
action defined inholiday-hours.js
router:# routes/holiday-hours.js actions: { ... deleteHoliday(holiday) { console.log('ROUTE-> deleteHoliday called'); let holidayToDelete = this.store.peekRecord('holiday-hour', holiday.get('id')); holidayToDelete.destroyRecord().then(function() { this.get('flashMessages').success(route.get('i18n').t('flash.holiday.removed')); }); },
Here is how the action is triggered from the component template:
# templates/components/holiday-hour.hbs <button type="button" class="btn btn-danger btn-sm mt-1" {{action 'deleteHoliday' holiday}}> <span class="oi oi-trash"></span> </button>
And it is never called Image may be NSFW.
Clik here to view.What is wrong with that ? Thank you.
Posts: 1
Participants: 1