This should do the trick:
<% if (typeof(date) !== "undefined") { %>
<span class="date"><%= date %></span>
<% } %>
Remember that in underscore.js templates if
and for
are just standard javascript syntax wrapped in <% %>
tags.
More Related Contents:
- Explanation of …
- Underscore template throwing variable not defined error
- Loading Backbone and Underscore using RequireJS
- External template in Underscore
- Backbone.js : repopulate or recreate the view?
- correctly implement backbone comparators
- What is the difference between these Backbone/Underscore .bind() methods?
- Find by key deep in a nested array
- How to dynamically change header based on AngularJS partial view?
- What does `void 0` mean? [duplicate]
- Backbone: Why assign `$(‘#footer’)` to `el`? [duplicate]
- Access a variable outside the scope of a Handlebars.js each loop
- Comparing two arrays of objects, and exclude the elements who match values into new array in JS
- In Android Webview, am I able to modify a webpage’s DOM?
- How to load bootstrapped models in Backbone.js while using AMD (require.js)
- What is two way binding?
- Ways to save Backbone.js model data?
- How to handle initializing and rendering subviews in Backbone.js?
- Group by multiple values Underscore.JS but keep the keys and values
- Dynamically refresh a part of the template when a variable is updated golang
- How to improve rendering performance when using $.html()
- Are ES6 template literals faster than string concatenation?
- Backbone View: Inherit and extend events from parent
- Backbone.View “el” confusion
- Disposing of view and model objects in Backbone.js
- Backbone.js – data not being populated in collection even though fetch is successful
- How to redirect on another page and pass parameter in url from table?
- Extending React.js components
- Super in Backbone
- Remove duplicates in an object array Javascript