20120518 advanced jsrendertemplatingfeatures

559 views

Published on

Published in: Technology, Lifestyle
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
559
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

20120518 advanced jsrendertemplatingfeatures

  1. 1. Advanced JsRender Templating Features drake1 2012/05/18
  2. 2. Agenda External Templates View Paths Expressions Registering Custom Tags Converters Helper Functions and Template Parameters Helper Functions for Unique Scenarios Which to Use? Allow code 2 2012/05/18
  3. 3. External Templates Code reuse is one of the big advantages of using templates Templates that should accessible from multiple pages It’s easy to use 3 2012/05/18
  4. 4. Suggest Convention External templates is to prefix the file name with an underscore Suffix all template files with .tmpl.html 4 2012/05/18
  5. 5. Code for Rendering an External Template5 2012/05/18
  6. 6. Example6 2012/05/18
  7. 7. View Paths7 2012/05/18
  8. 8. Example8 2012/05/18
  9. 9. Expressions9 2012/05/18
  10. 10. Registering Custom Tags JsRender offers several powerful extensibility points such as A. custom tags B. converters C. helper functions and template parameters The syntax for calling each of these is shown here a {{myTag name}} a {{myConverter:name}} a {{:~myHelper(name)}} {{:~myParameter}} 10 2012/05/18
  11. 11. Custom tags11 2012/05/18
  12. 12. Converters12 2012/05/18
  13. 13. Helper Functions and TemplateParameters13 2012/05/18
  14. 14. Helper Functions for Unique Scenarios14 2012/05/18
  15. 15. Which to Use?15 2012/05/18
  16. 16. Allow code wrapping the code with a block prefixed with an asterisk {{* }} setting allowCode to true 16 2012/05/18
  17. 17. Other solution17 2012/05/18
  18. 18. Reference http://msdn.microsoft.com/en-us/magazine/hh975379.asp 18 2012/05/18

×