mardi 23 décembre 2014

Controller not picking up on actions sent from template

I have a problem with getting my controller to respond to an action from its corresponding template


controllers/calendars/show.js



import Ember from 'ember';

export default Ember.ObjectController.extend({
queryParams: ['year', 'week'],
year: null,
week: null,
incrementWeek: function() {
var currentWeek = this.get('week');
var nextWeek = moment(new Date(moment().week(currentWeek + 1))).week();

if (currentWeek > nextWeek) {
var currentYear = moment().year();
this.set('year', currentYear + 1);
}

this.set('week', nextWeek);
},

});


templates/calendars/show.hbs



<div class="week-control pull-left">
<a {{action "incrementWeek"}}>Next</a>
</div>


However, when I click the link I get an



Uncaught Error: Nothing handled the action 'incrementWeek'. 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.


To my knowledge, the controller doesnt return true, so Im unsure on how to proceed from here


thanks





Aucun commentaire:

Enregistrer un commentaire