Skip to content

Instantly share code, notes, and snippets.

@dupuchba
Last active December 28, 2015 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dupuchba/7541777 to your computer and use it in GitHub Desktop.
Save dupuchba/7541777 to your computer and use it in GitHub Desktop.
Filter to be used with Twitter Bootstrap col-md's and row's. Can be optimized greatly but still work well
'use strict';
angular.module('dailymotionApp')
.filter('col', function(){
return function(input, numColumns){
if(input !== undefined) {
var filtered = [];
for(var x = 0; x < input.length; x++){
if(x % numColumns === 0){
filtered.push(filtered.length);
}
}
return filtered;
}
}
}).filter('row', function(){
return function(input, row, numColumns){
if(input !== undefined) {
var returnArray = [];
for(var x = row * numColumns; x < row * numColumns + numColumns; x++){
if(x < input.length){
returnArray.push(input[x]);
}
else{
returnArray.push("");
}
}
return returnArray;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment