Reputation: 7
Here is my template code:
{{#if showDialog}}
{{#modal-dialog
translucentOverlay=true
containerClass="modal-dialog__container"
overlayClass="modal-dialog__overlay"
wrapperClass="modal-dialog"
}}
<h1 class="modal-dialog__title">Type your goal here</h1>
{{input class="settings-row__input"}}
<div class="wrap_buttons">
<input {{action "cancelOrgGoal"}} type="button" name="Cancel" value="Cancel" class="btn btn_cancel">
<input {{action "saveOrgGoal"}} type="button" name="Create" value="Select" class="btn btn_create">
</div>
{{/modal-dialog}}
{{/if}}
Here is my js code:
actions: {
saveOrgGoal() {
console.log('hi');
let orgGoal = store.createRecord('organization-goal', {
description: 'Rails is Omakase',
});
orgGoal.save(); // => POST to '/posts'
this.set('showDialog', true);
},
cancelOrgGoal() {
console.log('hi');
this.set('showDialog', false);
}
}
I am using the addon ember-modal-dialog
When I click on either of the buttons the actions are not triggering and nothing is logged in the js console.
Can anyone see why this is? Am I doing some silly mistake?
Upvotes: 0
Views: 70
Reputation: 65173
Based on your comment about file paths, routes can't have actions that are directly callable from the template.
Without extracting a component, you'd want to define your actions on the controller for that route.
model
Hope this helps! :)
Upvotes: 3