Created
October 27, 2017 14:10
-
-
Save austincunningham/5bb7c4fbc0ea5343c363d6b294a6621e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function initModule() { | |
var moduleName = 'wfm.step.survey'; | |
var ngModule = angular.module(moduleName, []); | |
require('../../dist'); | |
ngModule.directive('survey', function($templateCache) { | |
return { | |
restrict: 'E' | |
, template: $templateCache.get('wfm-template/survey.tpl.html') | |
, controller: function($scope) { | |
$scope.model = $scope.result.submission; | |
}, | |
controllerAs: 'ctrl' | |
}; | |
}); | |
ngModule.directive('surveyForm', function($templateCache) { | |
return { | |
restrict: 'E' | |
, template: $templateCache.get('wfm-template/survey-form.tpl.html') | |
, controller: function($scope) { | |
var self = this; | |
self.model = {}; | |
self.parentController = $scope.$parent; | |
self.webLanguages = [ 'HTML','CSS', 'JavaScript', 'Java' ]; | |
self.back = function(event) { | |
self.parentController.ctrl.triggerBackStep(self.model); | |
event.preventDefault(); | |
event.stopPropagation(); | |
}; | |
self.done = function(event) { | |
self.parentController.ctrl.triggerCompleteStep(self.model); | |
event.preventDefault(); | |
event.stopPropagation(); | |
}; | |
} | |
, controllerAs: 'ctrl' | |
}; | |
}); | |
return moduleName; | |
} | |
module.exports = initModule; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment