This repository has been archived by the owner on Apr 13, 2022. It is now read-only.
ng-attr-* entry in $attrs
has incorrect casing
#16624
Milestone
$attrs
has incorrect casing
#16624
I'm submitting a ...
Current behavior:
The entries in
$attrs
created byng-attr-*
have the incorrect camel casing when the attribute has mixed case.Details
Normally the keys in
$attrs
get normalized bydirectiveNormalize(name.toLowerCase())
: https://github.com/angular/angular.js/blob/v1.7.2/src/ng/compile.js#L2274But for
ng-attr-*
the name gets partially normalized by theng-attr-*
logic before being normalized again in the standard way. I think this has existed since mixed case attributes were supported.This causes things like
ng-attr-my-camel_prop="..."
to be$attrs.myCamelprop
instead of$attrs.myCamelProp
. Wheremy-camel_prop="..."
would be$attrs.myCamelProp
.Note that the actual attribute put onto the element is correct, it's only the entry in
$attrs
and$attrs.$attr
that have the incorrect casing. For exampleng-attr-my-camel_case
correctly maps to themy-camelCase
attribute, its just the key in$attrs.myCamelcase
and$attrs.$attr.myCamelcase
that are wrong.Expected / new behavior:
Consistent attribute name normalizing between
ng-attr-*
and normal attributes.Anything else:
I wonder if
$attrs.$set
has any issues? https://github.com/angular/angular.js/blob/v1.7.2/src/ng/compile.js#L1762-L1765The text was updated successfully, but these errors were encountered: