Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module("components", []).directive("grid", function () {
- return {
- replace: true,
- restrict: "AE",
- transclude: true,
- scope: {},
- templateUrl: "../scripts/angularjs/components/templates/grid.html",
- link: function (scope, element, attrs) {
- if(attrs.cols) {
- var num = element[0].children.length;
- var i = parseInt(attrs.cols);
- //if(console) console.log("grid: ", num, i);
- var added = 0;
- while(i < num) {
- var br = document.createElement("br");
- element[0].insertBefore(br, element[0].children[i+added]);
- added++;
- i += parseInt(attrs.cols);
- }
- }
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement