Reputation: 4049
I have created a package in my meteor app. Which one has a client part. It is getting troubles for using Template.xxx.events
this code chat.html:
<template name="accountEasyChat">
{{messages}}
{{> write}}
</template>
<template name="write">
<input type="text" id="text_message"/><button id="send_message">Enviar</button>
</template>
and chat.js
Meteor.subscribe('accountEasyChatMessages')
UI.registerHelper('messages',function(){
Messages.find({}).forEach(function(m){
messages = messages + m.message
})
return messages
});
Template.write.events({
'click': function(event, template) {
console.log('test')
}
});
if I comment this:
Template.write.events({
'click': function(event, template) {
console.log('test')
}
});
Everything works ok.
Upvotes: 0
Views: 77
Reputation: 8345
In Package.onUse
you need to add a dependency to the package "templating" to get access to Template
.
By the way, UI.registerHelper
is deprecated in favor of Template.registerHelper
.
Upvotes: 1