From 12f28c61e8caa132e672f7ddca199038b449ae40 Mon Sep 17 00:00:00 2001 From: rnlee0054 Date: Tue, 19 May 2015 13:47:35 -0700 Subject: [PATCH] Implemented simple pull to deck from feed --- scripts/DeckController.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/DeckController.js b/scripts/DeckController.js index 8b0e061..c5e2e35 100644 --- a/scripts/DeckController.js +++ b/scripts/DeckController.js @@ -1,18 +1,19 @@ var app = angular.module('flashy.DeckController', ['ui.router']); -app.controller('DeckController', ['$scope', '$http', function($scope, $http) { - - - - - - +app.controller('DeckController', ['$scope', '$http', '$stateParams', + function($scope, $http, $stateParams) { // cards array + sectionId = $stateParams.sectionId; $scope.cards = []; - $scope.cards[0] = { 'content': 'abc' }; - $scope.cards[1] = { 'content': 'xyz' }; - $scope.cards[2] = { 'content': 'qwe' }; + $http.get('/api/sections/' + sectionId + '/deck/'). + success(function(data) { + console.log(data); + $scope.cards = data; + }). + error(function(err) { + console.log('pulling feed failed'); + }); // reorganize cards in array based on time -- 1.9.1