Skip to content

Instantly share code, notes, and snippets.

@austincunningham
Created October 27, 2017 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austincunningham/5bb7c4fbc0ea5343c363d6b294a6621e to your computer and use it in GitHub Desktop.
Save austincunningham/5bb7c4fbc0ea5343c363d6b294a6621e to your computer and use it in GitHub Desktop.
'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