From a276a49eeba1cc4b7089be45f464520b77b40a79 Mon Sep 17 00:00:00 2001 From: Tetranoir Date: Mon, 25 May 2015 19:25:30 -0700 Subject: [PATCH] fixed slopy commit, not breaking things, but isnt perfect --- scripts/FeedController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/FeedController.js b/scripts/FeedController.js index 2a77301..3515ecd 100644 --- a/scripts/FeedController.js +++ b/scripts/FeedController.js @@ -1,6 +1,6 @@ angular.module('flashy.FeedController', ['ui.router']). - controller('FeedController', function($scope, $rootScope, $stateParams, $state, $http) { + controller('FeedController', function($scope, $rootScope, $stateParams, $state, $http, $window) { console.log('Hello from feed'); sectionId = $stateParams.sectionId; $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId}); @@ -15,13 +15,14 @@ angular.module('flashy.FeedController', ['ui.router']). return Math.floor(avail / 250); } - function createCols() { + function createCols(data) { $scope.cardCols = []; for (i = 0; i < $scope.cols; i++) $scope.cardCols.push([]); var i = 0; for (card in data) { if (i >= $scope.cols) i = 0; $scope.cardCols[i++].push(card); + } } angular.element($window).bind('resize', $scope.refreshCards); @@ -31,8 +32,7 @@ angular.module('flashy.FeedController', ['ui.router']). $http.get('/api/sections/' + sectionId + '/feed/'). success(function(data) { console.log(data); - createCols(); - } + createCols(data); console.log('success in refresh cards...'); }). error(function(err) { -- 1.9.1