From eb53423a41136fcda0c5e711f2d104952080354b Mon Sep 17 00:00:00 2001 From: Luis Ramón López Date: Thu, 21 Feb 2013 21:56:40 +0100 Subject: feat($compile): support for dynamic template generation `template` and `templateUrl` properties can now be optionally defined via a function. This allows templates to be dynamically generated on the fly. --- test/ng/compileSpec.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'test') diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 6f56c6e6..f81199cb 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -647,6 +647,32 @@ describe('$compile', function() { }); + describe('template as function', function() { + + beforeEach(module(function() { + directive('myDirective', valueFn({ + replace: true, + template: function($element, $attrs) { + expect($element.text()).toBe('original content'); + expect($attrs.myDirective).toBe('some value'); + return '