0

Working my way through the Discover Meteor book. The code form chapters on creating postItem templates that include a link to specific posts just doesn't 'work' (no errors, but no result either).

See linked gists for code I'm using [1]. There are no errors in the console. I've also read up about changes introduced in Meteor 0.8 with Blaze and I suspect that this is causing the problem, however, the documentation seems to suggest template helper usage in my case is the same[2] and I can see from looking at various meteor created scripts such as router.js that older templating systems are at least attempted to be supported [3].

Why doesn't this code work? And is there a way to make only slight changes to get it working rather than moving over to iron-router and potentially departing too far from the edition of Discover Meteor that I'm using?

[1] client/views/posts/post_item.html: https://gist.github.com/Trindaz/11139437; client/helpers/router.js: https://gist.github.com/Trindaz/11139409;

[2] http://meteorpedia.com/read/Blaze_Notes#Template Helpers [Note: space before 'Helpers' in this link breaks it] This appears to be more about block helpers than the way I'm using helpers, but seems to be the extent of any discussion on helper usage so I assumed everything else remained unchanged.

[3] https://github.com/tmeasday/meteor-router/blob/master/lib/router_client.js#L88

4

1 回答 1

0

写完这篇文章后,我几乎立即找到了答案,留给未来的谷歌人。

该问题似乎是由https://github.com/tmeasday/meteor-router/blob/v0.6.1/lib/router_client.js#L89-L90UI.body上的成员分配引起的。这打破了 Meteor 0.8.0-rc3 https://groups.google.com/forum/#!msg/meteor-talk/oatU1zzcaeQ/54ay-pPlRrwJ中引入的更改。

从发布中:“模板不再自动访问祖先的助手 [11]。如果您使用 UI.body.helpers 声明助手,则需要切换到 UI.registerHelper。”

现在这一切可能都是多余的,因为工作已经转移到铁路由器上。

于 2014-04-22T23:46:40.080 回答