From 843f762c573e38a044f920c5575c6feb46bc7226 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 2 May 2012 16:04:11 -0700 Subject: fix($compile): prevent duplicate directive controller instantiation Closes #876 --- src/ng/compile.js | 4 +++- test/ng/compileSpec.js | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/ng/compile.js b/src/ng/compile.js index 59a70145..d0b6e749 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -819,7 +819,9 @@ function $CompileProvider($provide) { originalWidgetNode = tElement[0], asyncWidgetDirective = directives.shift(), // The fact that we have to copy and patch the directive seems wrong! - syncWidgetDirective = extend({}, asyncWidgetDirective, {templateUrl:null, transclude:null}), + syncWidgetDirective = extend({}, asyncWidgetDirective, { + controller: null, templateUrl: null, transclude: null + }), html = tElement.html(); tElement.html(''); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 1aef24fe..54837bf7 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -1692,7 +1692,45 @@ describe('$compile', function() { element = $compile('