Cách tạo một hàm cho tất cả các mẫu trong thiên thạch?cách tạo hàm toàn cục trong mẫu sao băng
index.js
// Some function
function somefunction(){
return true;
}
Test1.js
Template.Test1.events({
'click button' : function (event, template){
//call somefunction
}
});
Test2.js
Template.Test2.events({
'click button' : function (event, template){
//call some function
}
});
Bản sao có thể có của [Chức năng toàn cầu cho trình trợ giúp mẫu Meteor] (http://stackoverflow.com/questions/20681761/global-function-for-meteor-template-helper) –