Ember newbie. Using 2.3.0. To an existing application I need to add a button that toggles content on and off the screen. Following the existing code patterns, I added the following two files.
app/components/help.js
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
toggleHelp() {
this.toggleProperty('isShowingHelp');
}
}
});
templates/components/help.js
<div class="help">
<a href="#" >help</a>
</div>
<p>HELPHELPHELP</p>
And then in various *.hbs files I'm adding to get the button to show up where it is needed.
The button renders as expected as
<div class="help">
<a href="#" data-ember-action="493">help</a>
</div>
But when I click, I get the error, "Nothing handled the action 'toggleHelp'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble."
I checked the Ember documentation and saw that this matches the instructions.
I think the issue might be because I am calling it as a partial
, but none of the other options (view
, render
, outlet
) seems to apply to my limited case.
As per this answer, I tried , but then the error when I click turned into, "ember.debug.js:29112 Uncaught TypeError: Cannot read property 'send' of undefined."
I'm at a total loss... Can anyone point out what I'm missing here? Thanks!
Aucun commentaire:
Enregistrer un commentaire