diff --git a/app/scripts/components/form/index.js b/app/scripts/components/form/index.js index ee55bee4..38b0448b 100644 --- a/app/scripts/components/form/index.js +++ b/app/scripts/components/form/index.js @@ -1,10 +1,9 @@ 'use strict'; -module.exports = function () { - return { - transclude: true, - replace: true, - template: ` -
` - }; +var transclude = require('utils/transclude'); + +module.exports = function() { + return transclude({ + template: `
` + }); }; diff --git a/app/scripts/components/formRow/index.js b/app/scripts/components/formRow/index.js index c228e6c5..2386c5d5 100644 --- a/app/scripts/components/formRow/index.js +++ b/app/scripts/components/formRow/index.js @@ -1,10 +1,9 @@ 'use strict'; -module.exports = function () { - return { - transclude: true, - replace: true, - template: ` -
` - }; +var transclude = require('utils/transclude'); + +module.exports = function() { + return transclude({ + template: `
` + }); }; diff --git a/app/scripts/components/formSection/index.js b/app/scripts/components/formSection/index.js index 63e7e32d..2643ff4d 100644 --- a/app/scripts/components/formSection/index.js +++ b/app/scripts/components/formSection/index.js @@ -1,10 +1,9 @@ 'use strict'; -module.exports = function () { - return { - transclude: true, - replace: true, - template: ` -
` - }; +var transclude = require('utils/transclude'); + +module.exports = function() { + return transclude({ + template: `
` + }); }; diff --git a/app/scripts/utils/transclude.js b/app/scripts/utils/transclude.js new file mode 100644 index 00000000..2f9c060f --- /dev/null +++ b/app/scripts/utils/transclude.js @@ -0,0 +1,15 @@ +'use strict'; + +var _ = require('lodash'); + +module.exports = function transclude(options) { + return _.extend({ + transclude: true, + replace: true, + link(scope, element, attr, controller, transcludeFn) { + transcludeFn(scope, function (clone) { + element.empty().append(clone); + }); + } + }, options); +};