diff --git a/src/AngularPublic.js b/src/AngularPublic.js index a317d4ddacb4..d1ae4a187841 100644 --- a/src/AngularPublic.js +++ b/src/AngularPublic.js @@ -71,6 +71,7 @@ function publishExternalAPI(angular){ form: ngFormDirective, script: scriptTemplateLoader, select: selectDirective, + style: styleDirective, option: optionDirective, ngBind: ngBindDirective, ngBindHtml: ngBindHtmlDirective, diff --git a/src/directives.js b/src/directives.js index 8a2af70449b9..2d42d3efa07c 100644 --- a/src/directives.js +++ b/src/directives.js @@ -969,3 +969,9 @@ var ngTranscludeDirective = valueFn({ }); }] }); + + +var styleDirective = valueFn({ + restrict: 'E', + terminal: true +}); diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 88e70b506a2d..c05337457c4c 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -557,4 +557,28 @@ describe("directive", function() { expect(element.hasClass('bar')).toBe(true); })); }); + + + describe('style', function() { + + it('should not compile style element', inject(function($compile, $rootScope) { + element = jqLite(''); + $compile(element)($rootScope); + $rootScope.$digest(); + + // read innerHTML and trim to pass on IE8 + expect(trim(element[0].innerHTML)).toBe('should {{notBound}}'); + })); + + + it('should compile content of element with style attr', inject(function($compile, $rootScope) { + element = jqLite('
{{bind}}
'); + $compile(element)($rootScope); + $rootScope.$apply(function() { + $rootScope.bind = 'value'; + }); + + expect(element.text()).toBe('value'); + })); + }); });