(function() {
	'use strict';

	// Todo: display a list of the created questions with ng-repeat
	// Todo: selecting a question from the list opens edit menu -> modal

	function CreateQuizController($scope, $uibModal, quizStorage) {
		var self = this;

		self.bonus = {
			title: 'spinderman',
			answers: [{text: 'as', letter: 'a'}, {text: 'bas', letter: 'b'}]
		};

		self.quiz = {
			title: '',
			description: '',
			questions: []
		};

		self.addQuiz = function addQuiz(quiz) {
			quizStorage.addQuiz(quiz);
		};

		self.addQuestion = function addQuestion(question) {
			var modalInstance = $uibModal.open({
				animation: true,
				templateUrl: 'views/add-question.html',
				controller: 'AddQuestionController',
				controllerAs: 'ctrl',
				resolve: {
					items: question || self.bonus
				}
			});

			modalInstance.result.then(function(question) {
				if (question !== null) {
					self.quiz.questions.push(question);
				}

				console.log(self.quiz.questions);
			}, function() {
				console.log('Modal dismissed at: ' + new Date());
				console.log(self.bonus);
			});
		};
	}

	angular.module('quizProjectApp.controllers')
		.controller('CreateQuizController', ['$scope', '$uibModal', 'quizStorageService', CreateQuizController]);
}());
@@ -28,141 +28,100 @@
 ;%0A%0A%09
-// Todo: display a list of the created questions with ng-repeat%0A%09// Todo: selecting a question from the list opens edit menu -%3E modal
+var DEFAULT_STORAGE = %7B%0A%09%09quiz: %7B%0A%09%09%09title: '',%0A%09%09%09description: '',%0A%09%09%09questions: %5B%5D%0A%09%09%7D%0A%09%7D;
 %0A%0A%09f
@@ -167,16 +167,33 @@
 ibModal,
+ $sessionStorage,
  quizSto
@@ -226,119 +226,69 @@
 %0A%0A%09%09
-self.bonus = %7B%0A%09%09%09title: 'spinderman',%0A%09%09%09answers: %5B%7Btext: 'as', letter: 'a'%7D, %7Btext: 'bas', letter: 'b'%7D%5D%0A%09%09%7D;
+$scope.$storage = $sessionStorage.$default(DEFAULT_STORAGE); 
 %0A%0A%09%09
@@ -296,131 +296,225 @@
 elf.
-q
+addQ
 uiz = 
-%7B%0A%09%09%09title: '',%0A%09%09%09description: '',%0A%09%09%09questions: %5B%5D%0A%09%09%7D;%0A%0A%09%09self.addQuiz = function addQuiz(quiz) %7B%0A%09%09%09quiz
+function addQuiz(quiz) %7B%0A%09%09%09quiz = JSON.parse(JSON.stringify(quiz));%0A%09%09%09quizStorage.addQuiz(quiz);%0A%09%09%09console.log('bachka');%0A%09%09%7D;%0A%0A%09%09self.removeQuestion = function removeQuestion(index) %7B%0A%09%09%09$session
 Storage.
 addQ
@@ -513,70 +513,98 @@
 age.
-addQuiz(quiz);%0A%09%09%7D;%0A%0A%09%09self.addQuestion = function addQuestion
+quiz.questions.splice(index, 1);%0A%09%09%7D;%0A%0A%09%09self.openQuesitonMenu = function openQuesitonMenu
 (que
@@ -823,22 +823,8 @@
 tion
- %7C%7C self.bonus
 %0A%09%09%09
@@ -918,20 +918,31 @@
  %7B%0A%09%09%09%09%09
+$
 se
-lf
+ssionStorage
 .quiz.qu
@@ -1235,16 +1235,35 @@
 bModal',
+ '$sessionStorage',
  'quizSt

create quiz controller now uses local storage to keep the currently created quiz