简体   繁体   中英

Template Rendered callback in Meteor 0.8.0 blaze

With this update and the introduction to the new template engine Blaze, I'm having a few issues, more specifically with the Template Rendered callback.

The one along the lines of template.my_template.rendered no longer seems to work for me. Giving me undefined when I try to log ( this._id ) and none of the content inside of it actually works.

I read in the introduction to blaze that Meteor.render has been removed. Do the two of these have anything in common? What's the updated syntax to do this if it has been changed?

If you use this._id in your Template rendered callback, try using this.data._id instead, now. I'm a bit unsure why this._id worked for you in the rendered callback before.

If it was your helper and not your rendered callback it would remain as this._id , however some rules have changed depending on whether your template is within another template.

There is a migration guide that can help you structure your templates for blaze. You could also post here but given the details you have provided there isn't enough information to determine what the real issue is.

Meteor.render is deprecated. There is a new UI.render namespace ( http://docs.meteor.com/#ui ) that can do something similar. It depends what you want to do, but UI.insertWithData may do something similar.

See the migration docs on Meteor.render: https://github.com/meteor/meteor/wiki/Using-Blaze#meteorrender-has-been-removed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM