20120518 advanced jsrendertemplatingfeatures

  • 370 views
Uploaded on

 

More in: Technology , Lifestyle
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
370
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Advanced JsRender Templating Features drake1 2012/05/18
  • 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. 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. 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. Code for Rendering an External Template5 2012/05/18
  • 6. Example6 2012/05/18
  • 7. View Paths7 2012/05/18
  • 8. Example8 2012/05/18
  • 9. Expressions9 2012/05/18
  • 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. Custom tags11 2012/05/18
  • 12. Converters12 2012/05/18
  • 13. Helper Functions and TemplateParameters13 2012/05/18
  • 14. Helper Functions for Unique Scenarios14 2012/05/18
  • 15. Which to Use?15 2012/05/18
  • 16. Allow code wrapping the code with a block prefixed with an asterisk {{* }} setting allowCode to true 16 2012/05/18
  • 17. Other solution17 2012/05/18
  • 18. Reference http://msdn.microsoft.com/en-us/magazine/hh975379.asp 18 2012/05/18