From bf79bd4194eca2118ae1c492c08dbd217f5ae810 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 20 Aug 2013 16:08:24 -0700 Subject: fix(ngTransclude): make the transclusion available to parent post-link previously the translusion was appended the the ngTranslude element via $evalAsync which makes the transluded dom unavailable to parent post-linking functions. By appending translusion in linking phase, post-linking functions will be able to access it. --- test/ng/compileSpec.js | 59 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'test/ng/compileSpec.js') diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 28dc57fe..7c24e1d9 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2823,10 +2823,67 @@ describe('$compile', function() { expect(jqLite(element.find('span')[1]).text()).toEqual('T:true'); }); }); + + + it('should make the result of a transclusion available to the parent directive in post-linking phase (template)', + function() { + module(function() { + directive('trans', function(log) { + return { + transclude: true, + template: '
', + link: { + pre: function($scope, $element) { + log('pre(' + $element.text() + ')'); + }, + post: function($scope, $element) { + log('post(' + $element.text() + ')'); + } + } + }; + }); + }); + inject(function(log, $rootScope, $compile) { + element = $compile('