Commit a276a49eeba1cc4b7089be45f464520b77b40a79

Authored by Tetranoir
1 parent 3918ba7a5f

fixed slopy commit, not breaking things, but isnt perfect

Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff

scripts/FeedController.js View file @ a276a49
1 1 angular.module('flashy.FeedController', ['ui.router']).
2 2  
3   - controller('FeedController', function($scope, $rootScope, $stateParams, $state, $http) {
  3 + controller('FeedController', function($scope, $rootScope, $stateParams, $state, $http, $window) {
4 4 console.log('Hello from feed');
5 5 sectionId = $stateParams.sectionId;
6 6 $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId});
7 7  
... ... @@ -15,13 +15,14 @@
15 15 return Math.floor(avail / 250);
16 16 }
17 17  
18   - function createCols() {
  18 + function createCols(data) {
19 19 $scope.cardCols = [];
20 20 for (i = 0; i < $scope.cols; i++) $scope.cardCols.push([]);
21 21 var i = 0;
22 22 for (card in data) {
23 23 if (i >= $scope.cols) i = 0;
24 24 $scope.cardCols[i++].push(card);
  25 + }
25 26 }
26 27  
27 28 angular.element($window).bind('resize', $scope.refreshCards);
... ... @@ -31,8 +32,7 @@
31 32 $http.get('/api/sections/' + sectionId + '/feed/').
32 33 success(function(data) {
33 34 console.log(data);
34   - createCols();
35   - }
  35 + createCols(data);
36 36 console.log('success in refresh cards...');
37 37 }).
38 38 error(function(err) {