diff --git a/src/ng/compile.js b/src/ng/compile.js index 2e3d78677b52..d197bbe19548 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1588,6 +1588,7 @@ function $CompileProvider($provide) { dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value; } else if (key == 'style') { $element.attr('style', $element.attr('style') + ';' + value); + dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value; // `dst` will never contain hasOwnProperty as DOM parser won't let it. // You will get an "InvalidCharacterError: DOM Exception 5" error if you // have an attribute like "has-own-property" or "data-has-own-property", etc. diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 5bdbad42c776..3e35fae7dc33 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -504,6 +504,14 @@ describe('$compile', function() { expect(element).toBe(attr.$$element); } })); + directive('replaceWithInterpolatedStyle', valueFn({ + replace: true, + template: '
Replace with interpolated style!
', + compile: function(element, attr) { + attr.$set('compiled', 'COMPILED'); + expect(element).toBe(attr.$$element); + } + })); })); @@ -581,13 +589,22 @@ describe('$compile', function() { })); - it('should handle interpolated css from replacing directive', inject( + it('should handle interpolated css class from replacing directive', inject( function($compile, $rootScope) { element = $compile('
')($rootScope); $rootScope.$digest(); expect(element).toHaveClass('class_2'); })); + if (!msie || msie > 10) { + // style interpolation not working on IE<11. + it('should handle interpolated css style from replacing directive', inject( + function($compile, $rootScope) { + element = $compile('
')($rootScope); + $rootScope.$digest(); + expect(element.css('width')).toBe('2px'); + })); + } it('should merge interpolated css class', inject(function($compile, $rootScope) { element = $compile('
')($rootScope);