Created
October 14, 2016 19:36
-
-
Save randallknutson/0a83f1afde7c281b666739a1044b9e87 to your computer and use it in GitHub Desktop.
Create form wrapper with submit message.
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
angular.module('spryapp') | |
.directive('spryform', function () { | |
return { | |
restrict: 'E', | |
replace: true, | |
scope: { | |
src: '=', | |
message: '=', | |
form: '=?', | |
submission: '=?' | |
}, | |
template: '' + | |
'<div>' + | |
' <formio ng-if="!submitted" src="src" form="form" submission="submission"></formio>' + | |
' <div ng-if="submitted">{{ message }}</div>' + | |
'</div>', | |
controller: ['$scope', function ($scope) { | |
$scope.submitted = false; | |
$scope.$on('formSubmission', function(submission) { | |
$scope.submitted = true; | |
}); | |
}] | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment