`Template.foo.rendered` does not work #136

Closed
DirkStevens opened this Issue Feb 22, 2013 · 2 comments

2 participants

@DirkStevens

I put a "ask" blade view in a the "client/views" folder.
I defined a small head.blade view.
I did not define a body.blade view.

In Meteor.startup the template is added to the body:

Meteor.startup(function(){

$("body").append(Meteor.render(Template["client/views/ask"]));

});

This works.

When I define a rendered handler - I get a crash. (This handler works in the original Handlebars equivalent template)

Template["client/views/ask"].rendered = function() {

$(this.find("#navi")).localScroll(800);

...

};

It looks like this is not referring to the template's DOM now but to the template function:

this
Object
tmpl_data: Object
events: Object
helpers: function (helperMap) {
preserve: function (preserveMap) {
rendered: function () {
__proto_
: Object

Anyone knows what's going on?

@bminer bminer was assigned Mar 2, 2013
@bminer
Owner

This is caused by the Blade smart package thinking that the rendered callback is actually a view helper. As it stands, view helpers are called when a view is rendered. This behavior needs to be changed. I wonder how Handlebars works in Meteor? I will do some research...

@bminer
Owner

See the Meteor smart package file (package.js) to correct this bug.

@bminer bminer added a commit that closed this issue Mar 6, 2013
@bminer Fixed a bunch of Meteor stuff:
- Cleaned up Meteor `package.js` file to fix `require("blade")` hacks. Should fix #144.
- Now considering `client/views` folder to be in the root namespace. Closes #143.
- Fixed view helpers. They can now be used just like view locals. Also closes #136.
Push to version 3.0.0beta8
a050d0d
@bminer bminer closed this in a050d0d Mar 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment