Duh. The example WAS right just really confusing due to bad variable naming

This commit is contained in:
Paul Banks
2012-12-30 17:52:52 +00:00
parent ca22ca57e1
commit 0ffb2a9681
+1 -1
View File
@@ -138,7 +138,7 @@ Handlebars.js also adds the ability to define block helpers. Block helpers are f
```js
var source = "<ul>{{#people}}<li>{{#link}}{{name}}{{/link}}</li>{{/people}}</ul>";
Handlebars.registerHelper('link', function(context, options) {
Handlebars.registerHelper('link', function(options) {
return '<a href="/people/' + this.id + '">' + options.fn(this) + '</a>';
});
var template = Handlebars.compile(source);