From 584619c8e675cd49ec8e3990844f5c51d0464ff0 Mon Sep 17 00:00:00 2001 From: ddesigngithub Date: Sun, 26 Jan 2014 09:22:54 +0800 Subject: [PATCH] ng-transclude inside invalid --- src/ui-codemirror.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ui-codemirror.js b/src/ui-codemirror.js index a9c3153..cd518ac 100644 --- a/src/ui-codemirror.js +++ b/src/ui-codemirror.js @@ -23,26 +23,27 @@ angular.module('ui.codemirror', []) // - the initial content of the editor. // see http://codemirror.net/doc/manual.html#api_constructor var value = tElement.text(); - var codeMirror = new window.CodeMirror(function (cm_el) { - angular.forEach(tElement.prop('attributes'), function (a) { + return function postLink(scope, iElement, iAttrs, ngModel) { + + var codeMirror = new window.CodeMirror(function (cm_el) { + + angular.forEach(iElement.prop('attributes'), function (a) { if (a.name === 'ui-codemirror') { cm_el.setAttribute('ui-codemirror-opts', a.textContent); - } else { + } else if (a.name !== 'class') { cm_el.setAttribute(a.name, a.textContent); } }); // FIX replaceWith throw not parent Error ! - if (tElement.parent().length <= 0) { - tElement.wrap('
'); + if (iElement.parent().length <= 0) { + iElement.wrap('
'); } - tElement.replaceWith(cm_el); + iElement.replaceWith(cm_el); }, {value: value}); - return function postLink(scope, iElement, iAttrs, ngModel) { - var options, opts; options = uiCodemirrorConfig.codemirror || {};