{"size": 754, "ext": "js", "max_stars_repo_path": "angular/controllers/createQuestionController.js", "max_stars_repo_name": "tanimasingh23/online-survey-application", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "angular/controllers/createQuestionController.js", "max_issues_repo_name": "tanimasingh23/online-survey-application", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "angular/controllers/createQuestionController.js", "max_forks_repo_name": "tanimasingh23/online-survey-application", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.1333333333, "max_line_length": 149, "alphanum_fraction": 0.698938992}
myApp.controller('createQuestionController',['surveyAppService', '$location', '$routeParams', function( surveyAppService , $location , $routeParams){
	
	var main = this ;
	var surveyId = $routeParams.surveyId ;
	var data ;

	// function to create a new question
	this.newQuestion = function(){

		data = {
			questionText : main.questionText
		};
		
		surveyAppService.createQuestion(surveyId ,data)
		.then(function successCallback(response){
			alert("New question created successfully!");
			//console.log(main.response);
			$location.path('/edit/survey/'  + surveyId);

		}, function errorCallback(response){

			alert("Some error occured! Please check console.");
			console.log(response);

		});

	}; // end newQuestion
	

}]); // end of controller