ng-controller="plantCtrl"
. var someFn = function()
{
console.log( (new Date) );
};
var i = 0;
var max = 10;
var _interval = setInterval(function() {
if( i < max )
{
someFn();
i++;
} else {
clearInterval( _interval );
}
}, 1000);
Array.prototype.asyncEach = function (each, done) {
var i = -1, a = this
function iter() {
if (++i === a.length) { done && done(); return }
each.call(a, a[i], iter)
}
iter()
}
// Example
(new Array(10)).asyncEach(function (item, next) {
setTimeout(function () {
console.log("tick")
next()
}, 1000)
})
<div class="container">
<?php
$wp_query = new WP_Query();
$wp_query->query('showposts=2&post_type=event'.'&paged='.$paged); ?>
<?php if($wp_query->have_posts()) : ?>
<div class="row">
<?php $i = 0; ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<?php if($i == 2) : ?>
</div>
<div class="row">
<?php $i = 0; ?>
<?php endif; ?>
<div class="col-md-6"><?php the_title(); ?></div>
<?php $i++; ?>
<?php endwhile; ?>
</div>
<?php endif; wp_reset_query(); ?>
</div>