I'm trying to pass data to my partial which has a for loop. It seems the loop itself breaks:
<!-- Current Tweet Partials -->
<script id="active-tweet-partial" type="underscore/template">
<section class="tweetFlexItem">
<% console.log(sqTweetData.text); %>
<% for (var i = 0; i < sqTweetData.length; i++) { %>
<div class="activeTweet">
<div class="activeTweet__wrapper">
<div class="activeTweet__message"><%= sqTweetData[ i ].text %></div>
</div>
</div>
<% } %>
</section>
</script>
The console.log works and gives me the text I am looking for, however the for loop isn't working. If I place an alert(); inside the for loop, it does not run.
Any thoughts?
EDIT: Including Javascript
var Home = (function() {
var twitterData = {
user: [{
profile_image_url : "assets/avatar.png",
name : "@johnsnow"
}],
text : "Someone once said that I know nothing..."
};
// Partials
var tweetPartial = $('#active-tweet-partial').html();
tweetPartialCompiled = _.template( tweetPartial );
// DOM Handlers
function getTweetData() {
return twitterData;
}
sqTweetData = getTweetData();
// KICKSTART VIEW
function initHome() {
// load main content
$('#main-content').html(tweetPartialCompiled( sqTweetData ));
}
return {
init: initHome
};
})();