diff --git a/config.js b/config.js index 76ed1f7..5765022 100644 --- a/config.js +++ b/config.js @@ -11,6 +11,7 @@ angular.module('flashy', [ 'flashy.FlashcardDirective', 'flashy.ResetPasswordController', 'flashy.VerifyEmailController', + 'flashy.CardListController', 'ngCookies']). config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider', @@ -53,6 +54,12 @@ angular.module('flashy', [ templateUrl: 'templates/feed.html', controller: 'FeedController' }). + state('cardlist', { + resolve: auth_resolve, + url: '/cards/{sectionId}', + templateUrl: 'templates/cardlist.html', + controller: 'CardListController' + }). state('addclass', { resolve: auth_resolve, url: '/addclass', diff --git a/home.html b/home.html index b87ba4c..a100d69 100644 --- a/home.html +++ b/home.html @@ -58,6 +58,8 @@ + + @@ -71,6 +73,7 @@ + diff --git a/scripts/CardListController.js b/scripts/CardListController.js new file mode 100644 index 0000000..b51f901 --- /dev/null +++ b/scripts/CardListController.js @@ -0,0 +1,22 @@ +angular.module('flashy.CardListController', ['ui.router']). + controller('CardListController', ['$scope', '$state', '$http', '$stateParams', + function ($scope, $state, $http, $stateParams) { + // cards array + sectionId = $stateParams.sectionId; + $scope.cards = []; + + $http.get('/api/sections/' + sectionId + '/flashcards/'). + success(function (data) { + console.log(data); + $scope.cards = data; + }). + error(function (err) { + console.log('pulling feed failed'); + }); + $scope.viewFeed = function () { + $state.go('feed', {sectionId: sectionId}); + console.log('go to feed'); + }; + + + }]); diff --git a/templates/cardlist.html b/templates/cardlist.html new file mode 100644 index 0000000..8b03b97 --- /dev/null +++ b/templates/cardlist.html @@ -0,0 +1,20 @@ +
Name | +
---|
{{card.text}} | +
{{flashcard.text}}