FeedController.js 1.93 KB
angular.module('flashy.FeedController', ['ui.router']).
controller('FeedController', ['$scope', '$state', '$http', function($scope, $state, $http) {
console.log('Hello from feed');
$scope.viewDeck = function() {
$state.go('deck');
console.log('go to deck');
};
$scope.pullCard = function() {
console.log('card clicked');
};
$scope.create = false; // show make flashcard
$scope.pushCard = function() {
console.log('make! card content:' + $scope.text);
var pushed = new Date(Date.now());
console.log(pushed.toString());
// attempt to make card :(
$http.post('/api/flashcards/', {'text': $scope.text, 'pushed': pushed, 'mask': []}).
success(function(data) {
console.log('No way, really?');
}).
error(function(error) {
console.log('haha, n00b');
});
$scope.create = false; // hide make flashcard
$scope.text = '';
};
$scope.flashcard = 'hi i am a flashcard. I need to be really long and awesome I ain\'t know how long I am right now. Is it good enough now?????????? Howz about now???';
$scope.text = '';
$(document).ready(function(){
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal({
dismissible: true, // Modal can be dismissed by clicking outside of the modal
opacity: 0, // Opacity of modal background
in_duration: 300, // Transition in duration
out_duration: 200, // Transition out duration
/*ready: function() { alert('Ready'); }, // Callback for Modal open
complete: function() { alert('Closed'); } // Callback for Modal close*/
}
);
});
}]);