diff options
| -rw-r--r-- | src/AngularPublic.js | 1 | ||||
| -rw-r--r-- | src/directives.js | 6 | ||||
| -rw-r--r-- | test/directivesSpec.js | 24 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/AngularPublic.js b/src/AngularPublic.js index a317d4dd..d1ae4a18 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 8a2af704..2d42d3ef 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 88e70b50..c0533745 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('<style type="text/css">should {{notBound}}</style>'); + $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('<div style="some">{{bind}}</div>'); + $compile(element)($rootScope); + $rootScope.$apply(function() { + $rootScope.bind = 'value'; + }); + + expect(element.text()).toBe('value'); + })); + }); }); |
