Your SlideShare is downloading. ×
Using jQuery Templates
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Using jQuery Templates

1,902
views

Published on

This presentation by Dan Wahlin covers the fundamentals needed to get started using jQuery Templates. By using templates you can significantly reduce the amount of JavaScript that you write and keep …

This presentation by Dan Wahlin covers the fundamentals needed to get started using jQuery Templates. By using templates you can significantly reduce the amount of JavaScript that you write and keep your code-base more maintainable.

Published in: Technology, Business

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,902
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
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
  • Show John Resig's Micro-Template MIX 09 08/13/11 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Show John Resig's Micro-Template MIX 09 08/13/11 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Tech Ed North America 2010 08/13/11 19:49 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Tech Ed North America 2010 08/13/11 19:49 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Tech Ed North America 2010 08/13/11 19:49 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Tech Ed North America 2010 08/13/11 19:49 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Tech Ed North America 2010 08/13/11 19:49 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Transcript

    • 1. jQuery Templates And HTML5 Dan Wahlin
    • 2. Contact Info
      • Blog
      • http://weblogs.asp.net/dwahlin
      • Twitter
      • @DanWahlin
      • Email:
      • [email_address]
    • 3. Agenda
      • Why use Templates?
      • Introduction to jQuery Templates
      • jQuery Templates in Action
    • 4. Client-Side Template Solutions
      • HTML templates simplify building AJAX applications:
        • Minimize custom JavaScript
        • Simplify Maintenance
      • Several HTML template solutions exist:
        • John Resig's JavaScript Micro-Templating
        • jBind
        • Chain.js
        • jQuery Templates
    • 5. Maintainable Code?
      • var total;
      • $(order.Items).each(function()
      • {
      • var item = this;
      • $('#item' + item.ID) .append('<div>' + item.Title + '</div>');
      • total += item.Total;
      • });
      • $('#total').html(total);
    • 6. Agenda
      • Why use Templates?
      • Introduction to jQuery Templates
      • jQuery Templates in Action
    • 7. jQuery Template Tokens rev 1.0/0510 Chapter 5- {{if}}..{{/if}} {{each}}..{{/each}} ${ Property } {{tmpl}} {{wrap}} {{html}}
    • 8. jQuery Template Container
      • <script id=&quot;MyTemplate&quot; type=&quot;text/x-jquery-tmpl&quot; > ...
      • </script>
    • 9. jQuery Template Example
      • <script id=&quot;MyTemplate&quot; type=&quot;text/x-jquery-tmpl&quot;>
      • <div id=&quot;DeliveryDiv&quot;> ${ DeliveryName } </div>
      • </script>
    • 10. Applying a Template
        • <script id=&quot;MyTemplate&quot; type=&quot;text/x-jquery-tmpl&quot;>
        • <div id=&quot;DeliveryDiv&quot;> ${ DeliveryName} </div>
        • </script>
        • <div id=&quot;OutputDiv&quot;></div>
        • $('#MyTemplate') .tmpl(json) .appendTo('#OutputDiv');
    • 11. Adding Conditional Logic
          • {{if MainItems == null }}
          • <tr>
          • <td>No items selected</td>
          • </tr>
          • {{else}}
          • <tr>
          • <td>${product.Name}</td>
        • </tr>
        • {{/if}}
    • 12. Working with Loops
        • {{if MainItems == null }}
        • <tr>
        • <td>No items selected</td>
        • </tr>
        • {{else}}
        • {{each(i,mmi) MainItems}}
        • <tr>
        • <td>${mmi.Name}</td>
        • </tr>
        • {{/each}}
        • {{/if}}
    • 13. $index and $value Keywords
        • {{each MainItems}}
        • <tr>
        • <td>
        • ${$index}: ${$value.Name} </td>
        • </tr>
        • {{/each}}
    • 14. Agenda
      • Why use Templates?
      • Introduction to jQuery Templates
      • jQuery Templates in Action
    • 15.  
    • 16. Contact Info
      • Blog
      • http://weblogs.asp.net/dwahlin
      • Twitter
      • @DanWahlin
      • Email:
      • [email_address]

    ×