(function () { "use strict"; var QuestionFirstController = function ($scope, $location, userService) { $scope.model = { question: '' }; $scope.callback = function (prompt) { $location.url('question/' + prompt.promptId + '/first'); }; userService.getUser().then((user) => { $scope.variant = user.variants.customQuestion; }); $scope.callbackCustom = function (question) { $scope.errorMessage = ''; if (question.length > 10 && question.length <= 750) { userService.addQuestion(question) .then((prompt) => $location.url('question/' + prompt.promptId + '/first') ); } else { $scope.errorMessage = 'A custom question needs to have at least 10 and less than 750 characters.'; } }; }; QuestionFirstController.$inject = ['$scope', '$location', 'userService']; angular.module('streamApp').controller('questionFirstController', QuestionFirstController); })();