سؤال

I am trying the render the template through my js like below

Template.customerclaim({data:""}); 

It was working fine in previous version of meteorjs with the new update it is throwing error Property 'customerclaim' of object #<Object> is not a function.

هل كانت مفيدة؟

المحلول

If you want to render the result

Have a careful read of this section of the using blaze wiki. In short, what you are doing is no longer allowed so you need to use one of the example workarounds. Also see this related question.

If you want to return a string (e.g. for email templates)

Have a look at this issue. Specifically you can use this:

var toHTMLWithData = function (kind, data) {
  return UI.toHTML(kind.extend({data: function () { return data; }}));
};

To get a string, you can use it like:

var email = toHTMLWithData(Template.customerclaim, {name: 'John Doe'});

I'd recommend watching that issue for changes since this may not work in future versions.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top