summaryrefslogtreecommitdiffstats
path: root/README.markdown
diff options
context:
space:
mode:
authorCristi Burcă <scribu@gmail.com>2012-09-28 03:35:36 +0300
committerCristi Burcă <scribu@gmail.com>2012-09-28 03:35:36 +0300
commit9e582fa0ebf167a0f2c9fa32cd43c214917e1760 (patch)
tree676a1a6ed0348105fd2f199d18d5405fe4d08f13 /README.markdown
parentb5074a88ec17917309f5482de004076f3f676ad1 (diff)
downloadhandlebars.js-9e582fa0ebf167a0f2c9fa32cd43c214917e1760.zip
handlebars.js-9e582fa0ebf167a0f2c9fa32cd43c214917e1760.tar.gz
handlebars.js-9e582fa0ebf167a0f2c9fa32cd43c214917e1760.tar.bz2
fix Block Helpers example
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown6
1 files changed, 3 insertions, 3 deletions
diff --git a/README.markdown b/README.markdown
index ed0b022..44727ed 100644
--- a/README.markdown
+++ b/README.markdown
@@ -137,9 +137,9 @@ gets passed to the helper function.
Handlebars.js also adds the ability to define block helpers. Block helpers are functions that can be called from anywhere in the template. Here's an example:
```js
-var source = "<ul>{{#people}}<li>{{{#link}}}{{name}}{{/link}}</li>{{/people}}</ul>";
-Handlebars.registerHelper('link', function(context, fn) {
- return '<a href="/people/' + this.__get__("id") + '">' + fn(this) + '</a>';
+var source = "<ul>{{#people}}<li>{{#link}}{{name}}{{/link}}</li>{{/people}}</ul>";
+Handlebars.registerHelper('link', function(context, options) {
+ return '<a href="/people/' + this.id + '">' + context.fn(this) + '</a>';
});
var template = Handlebars.compile(source);