You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
When I create a directive with an attribute which scope is defined with &, leading and trailing whitespaces are lost (fiddle).
While it can be circumvented by creating a variable and passing the evaluated variable as the value (using attribute={{variable}}, see the fiddle), this looks like a bug to me.
The fiddle uses Angular 1.4.9, but it's still present in the current snapshot v1.5.6-build.4785+sha.707664a
The text was updated successfully, but these errors were encountered:
So, this has been the case since v1.0.0-rc.2 (8af4fde). I labelled this as a bug, but it could be expected behavior as well.
This is been around for so long, that I am not sure it is worth changing now.
If anyone wants to submit a PR, the problem "starts" at compile.js#L1887.
BREAKING CHANGE:
White-space in attributes is no longer trimmed automatically. This includes leading and trailing
whitespace, and attributes that are purely white-space.
This allows developers to use white-space in their attributes, for example as value for
input[type=radio], as a separator in ngList, or as a value in any custom directive binding.
To migrate, attributes that require trimming must now be trimmed manually.
A common cases where stray white-space can cause problems is when
attribute values are compared, for example in an $observer:
```
$attrs.$observe('myAttr', function(newVal) {
if (newVal === 'false') ...
});
```
Note that `$parse` trims expressions automatically, so attributes with expressions (e.g. directive
bindings) are unlikely to be affected by stray white-space.
Fixesangular#5513Fixesangular#14539Closesangular#5597
ngList test
Narretz
pushed a commit
to Narretz/angular.js
that referenced
this issue
Jun 8, 2016
BREAKING CHANGE:
White-space in attributes is no longer trimmed automatically. This includes leading and trailing
whitespace, and attributes that are purely white-space.
This allows developers to use white-space in their attributes, for example as value for
input[type=radio], as a separator in ngList, or as a value in any custom directive binding.
To migrate, attributes that require trimming must now be trimmed manually.
A common cases where stray white-space can cause problems is when
attribute values are compared, for example in an $observer:
```
$attrs.$observe('myAttr', function(newVal) {
if (newVal === 'false') ...
});
```
Note that `$parse` trims expressions automatically, so attributes with expressions (e.g. directive
bindings) are unlikely to be affected by stray white-space.
Fixesangular#5513Fixesangular#14539Closesangular#5597
ngList test
When I create a directive with an attribute which scope is defined with
&
, leading and trailing whitespaces are lost (fiddle).While it can be circumvented by creating a variable and passing the evaluated variable as the value (using
attribute={{variable}}
, see the fiddle), this looks like a bug to me.The fiddle uses Angular 1.4.9, but it's still present in the current snapshot v1.5.6-build.4785+sha.707664a
The text was updated successfully, but these errors were encountered: