Description
Hi,
I am trying to add a memberid field with incrementCounter
I get: Error invoking Method 'getCount'
the count value is undefined
I am new to meteor and I could not find a full example with incrementCounter so I may have done something wrong.
Thanks for your help.
I have the following code
if (Meteor.isServer) {
Meteor.methods({
'getCount' : function () {
var count = incrementCounter('memberid');
console.log("count : "+count);
return count;
}
});
}
...
if (Meteor.isClient) {
...
Template.member.helpers({
steps: function() {
return [{
id: 'personal-info',
title: 'Personal Info',
schema: Schema.personalInfo,
// template: 'personalInfo'
}, {
id: 'member-info',
title: 'Member Info',
schema: Schema.memberInfo,
// template: 'memberInfo',
},{
id: 'contact-info',
title: 'Contact Info',
schema: Schema.contactInfo,
// template: 'contactInfo',
onSubmit: function(data, wizard) {
var self = this;
var count = Meteor.call('getCount');
var mydata = .extend(wizard.mergedData(),{memberid:count});
Members.insert(.extend(mydata, data), function(err, id) {
if (err) {
self.done();
} else {
Router.go('viewMember', {
_id: id
});
}
});
}
}];
}
});
}