From 5a1a6b86a8dbcd8aa4fe9c59fad8d005eead686c Mon Sep 17 00:00:00 2001 From: jankuca Date: Wed, 25 Sep 2013 16:37:59 -0700 Subject: fix(ngTransclude): detect ngTranslude usage without a transclusion directive Closes #3759 --- src/ng/directive/ngTransclude.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ng/directive/ngTransclude.js b/src/ng/directive/ngTransclude.js index d7c9cd44..490ea21f 100644 --- a/src/ng/directive/ngTransclude.js +++ b/src/ng/directive/ngTransclude.js @@ -52,7 +52,15 @@ * */ var ngTranscludeDirective = ngDirective({ - controller: ['$transclude', function($transclude) { + controller: ['$element', '$transclude', function($element, $transclude) { + if (!$transclude) { + throw minErr('ngTransclude')('orphan', + 'Illegal use of ngTransclude directive in the template! ' + + 'No parent directive that requires a transclusion found. ' + + 'Element: {0}', + startingTag($element)); + } + // remember the transclusion fn but call it during linking so that we don't process transclusion before directives on // the parent element even when the transclusion replaces the current element. (we can't use priority here because // that applies only to compile fns and not controllers -- cgit v1.2.3