Tell me how to use underscore.js as a template engine?
Submitted by: AdministratorEverything you need to know about underscore template is here. Only 3 things to keep in mind:
<% %> - to execute some code
<%= %> - to print some value in template
<%- %> - to print some values with HTML escaped
That's all about it.
Simple example:
var foo = "blahblah";
var tpl = _.template("<h1>Heading for: <= fooo %></h1>");
this would be rendered in string <h1>Heading for: blahblah</h1>
Submitted by: Administrator
<% %> - to execute some code
<%= %> - to print some value in template
<%- %> - to print some values with HTML escaped
That's all about it.
Simple example:
var foo = "blahblah";
var tpl = _.template("<h1>Heading for: <= fooo %></h1>");
this would be rendered in string <h1>Heading for: blahblah</h1>
Submitted by: Administrator
Read Online Node.js Job Interview Questions And Answers
Top Node.js Questions
☺ | Explain Node.js Architecture? |
☺ | How to extract POST data in node.js? |
☺ | What is Node.js? |
☺ | Do you know how to debug node.js applications? |
☺ | Do you know how to get POST query in express node.js? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |