Correct way to write helper functions in Meteor

时间:2015-12-10 01:57:41

标签: meteor

I'm new to Meteor and I'm trying to figure out the difference between writing:

Template.main.folks =
  function () {
    return Clients.find();
};

and writing it using "helpers":

Template.main.helpers({
  folks: function () {
    return Clients.find();
});

Are they the same thing?

1 个答案:

答案 0 :(得分:1)

没什么区别,但第一个很快就会被删除。如果你这样做,它仍然会运行,但会给你deprecated警告