I am using CLNDR.js to show a calender with some events in it. For this purpose, I have the following code which makes an "Events this month"-box:
<% _.each(eventsThisMonth, function(event) { %>
<div class="event-item">
<div class="event-item-name"><%= event.title %></div>
<div class="event-item-date"><%= moment(event.date).format('L') %></div>
<div class="event-item-date"><%= moment(event.start).format('L') %> <%= moment(event.end).format('L') %></div>
</div>
<% }); %>
For each instance, either the event.date or event.start and event.end are empty, and if they are, I dont want to show them. However, I don't really understand the <%-annotation. Can I implement an if-sentence in this somehow?
Thanks!
Aucun commentaire:
Enregistrer un commentaire