diff --git a/src/ng/compile.js b/src/ng/compile.js index 9285b253d0b3..6a40f54f85f2 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1009,7 +1009,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { nName = directiveNormalize(name.toLowerCase()); attrsMap[nName] = name; - attrs[nName] = value = trim(attr.value); + attrs[nName] = value = attr.value; if (getBooleanAttrName(node, nName)) { attrs[nName] = true; // presence means true } diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index c37461fcc007..16d25a6627ff 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2387,6 +2387,14 @@ describe('$compile', function() { expect(componentScope.attrAlias).toEqual(componentScope.attr); })); + it('should copy simple attribute value with spaces', inject(function() { + compile('
'); + + expect(componentScope.attr).toEqual(' some text '); + expect(componentScope.attrAlias).toEqual(' some text '); + expect(componentScope.attrAlias).toEqual(componentScope.attr); + })); + it('should set up the interpolation before it reaches the link function', inject(function() { $rootScope.name = 'misko'; compile('
');