From f8944efe70b81e02704df9b53ea2546c80c73d3b Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 10 Dec 2013 16:45:54 -0800 Subject: fix(ngView): Add template to DOM before linking other directives The template needs to be added to the DOM before other directives at the same element as `ngView` are linked. Related to #5247. --- test/ngRoute/directive/ngViewSpec.js | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test') diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js index f4b28058..a8d1f459 100644 --- a/test/ngRoute/directive/ngViewSpec.js +++ b/test/ngRoute/directive/ngViewSpec.js @@ -582,6 +582,46 @@ describe('ngView and transcludes', function() { }); }); + + it('should link directives on the same element after the content has been loaded', function() { + var contentOnLink; + module(function($compileProvider, $routeProvider) { + $routeProvider.when('/view', {template: 'someContent'}); + $compileProvider.directive('test', function() { + return { + link: function(scope, element) { + contentOnLink = element.text(); + } + }; + }); + }); + inject(function($compile, $rootScope, $location) { + element = $compile('