javascript - Calling helper functions from within template.rendered in Meteor.js, error in 1.0, fine in 0.9.3 -


In an effort to avoid duplication of code, I found that there are helpful functions that a fu.rendered function (for example) . Why is it possible in the meteor map of 0.9.3, but throws an error in 1.0?

  Template.foo.helpers ({'fooFn': function () {return "something"}}); Template.foo.rendered = function () {var something = Template.foo.fooFn (); }  

Should I change the syntax in foo.rendered (am I telling it wrong?) Or maybe use a completely different approach (outside helpers ({}) Set the function and sing () and call on it? Or set it as a registered Helper function?

It seems that it is possible to find meteorite functions and make calls as meteorite 1.0.3.1, It is not to be used like this.

Still it can be done:

  Template.foo .__ Focus on the prominent place for the name of the supporting ["fooFn"] ()  

function name.

On the other hand, to work with it on a global name space function Attach, and then from any other place in your code, which is referred to as user3557327 .

Additionally you can use it:

  Template.registerH Elper ('myHelper', function) () return to  

to register a global assistant, and call it explicitly! Ly used:

  UI._globalHelpers ['myHelper'] ()  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -