From bb7f0842d434895577833fceceab62ced6260d4c Mon Sep 17 00:00:00 2001 From: "leon.shi" Date: Tue, 8 Dec 2015 15:23:24 +0800 Subject: [PATCH] update docs --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 75e7eae..ee30c9c 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ function simpleTemplating(data) { } ``` -Calling: +Call: ```js $('#pagination-container').pagination({ @@ -64,18 +64,20 @@ $('#pagination-container').pagination({ }) ``` -To make it easier to maintain, you'd better use specialized templating engine to rendering data. +To make it easier to maintain, you'd better use specialized templating engine to rendering data. Such as [Handlebars](http://handlebarsjs.com/) and [Undercore.template](http://underscorejs.org/#template). -Below is an example using [undercore.template](http://underscorejs.org/#template): +Fresh examples: + +## Handlebars HTML: ```html ``` @@ -86,7 +88,7 @@ JS: $('#pagination-container').pagination({ dataSource: [1, 2, 3, 4, 5, 6, 7, ... , 195], callback: function(data, pagination) { - var html = _.template($('#template-demo').html(), { + var html = Handlebars.compile($('#template-demo').html(), { data: data }); $('#data-container').html(html); @@ -94,16 +96,16 @@ $('#pagination-container').pagination({ }) ``` -Using [Handlebars](http://handlebarsjs.com/): +## Underscore HTML: ```html ``` @@ -114,7 +116,7 @@ JS: $('#pagination-container').pagination({ dataSource: [1, 2, 3, 4, 5, 6, 7, ... , 195], callback: function(data, pagination) { - var html = Handlebars.compile($('#template-demo').html(), { + var html = _.template($('#template-demo').html(), { data: data }); $('#data-container').html(html); @@ -122,7 +124,7 @@ $('#pagination-container').pagination({ }) ``` -Or any other templating engine what you prefer. +Or any other templating engine you prefer. # License -- GitLab