Last active
December 28, 2015 18:18
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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