Skip to content

Instantly share code, notes, and snippets.

@CaptainChemist
Created March 17, 2016 22:47
Show Gist options
  • Save CaptainChemist/ee9b9eee813111d43182 to your computer and use it in GitHub Desktop.
Save CaptainChemist/ee9b9eee813111d43182 to your computer and use it in GitHub Desktop.
Problems making a reactive method call
Template.QuadLayout.onCreated(function(){
Session.set('nextQuestionId', this.data.questionId);
Session.set('nextCurrentLevel', this.data.currentLevel);
Tracker.autorun(function(){
var nextQuestionId = Session.get('nextQuestionId');
var nextCurrentLevel = Session.get('nextCurrentLevel');
Meteor.call('checkToCreateBlankQuad',nextQuestionId, nextCurrentLevel);
});
});
Template.QuestionsLayoutButton.events({
'click .question-submit': function(e){
e.preventDefault();
Meteor.call('checkAnswers',this.questionId, this.lectureId, function(err, result){
Session.set('nextQuestionId', result.questionId);
Session.set('nextCurrentLevel', result.currentLevel);
});
}
});
Here, QuadLayout and QuestionsLayoutButtob are nested in the QuestionsLayout template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment