Skip to content

Commit 49660c6

Browse files
committed
fix(style): expressions in style tags
Enable data-binding for style tags closes angular#2387
1 parent 18c41af commit 49660c6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/ng/directive/style.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
var styleDirective = valueFn({
44
restrict: 'E',
5-
terminal: true
5+
terminal: false
66
});

test/ng/directive/styleSpec.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,20 @@ describe('style', function() {
99
});
1010

1111

12-
it('should not compile style element', inject(function($compile, $rootScope) {
13-
element = jqLite('<style type="text/css">should {{notBound}}</style>');
12+
it('should compile style element', inject(function($compile, $rootScope) {
13+
element = jqLite('<style type="text/css">.some-container{ width: {{elementWidth}}px; }</style>');
1414
$compile(element)($rootScope);
1515
$rootScope.$digest();
1616

1717
// read innerHTML and trim to pass on IE8
18-
expect(trim(element[0].innerHTML)).toBe('should {{notBound}}');
18+
expect(trim(element[0].innerHTML)).toBe('.some-container{ width: px; }');
19+
20+
$rootScope.$apply(function() {
21+
$rootScope.elementWidth = 200;
22+
});
23+
24+
// read innerHTML and trim to pass on IE8
25+
expect(trim(element[0].innerHTML)).toBe('.some-container{ width: 200px; }');
1926
}));
2027

2128

0 commit comments

Comments
 (0)