This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Description
Hi,
I am writing a ui directive and I want to be able to notify the user at certain points. So if I place an attribute on-move it's value will be evaluated (angular expression) when a user moves his mouse for instance. And I also have on-start, but it turns out that in my $attrs object in the directive linking function I don't have a property onStart but on. I started digging into angular and I found that piece of code (in collectDirectives function):
var directiveNName = ngAttrName.replace(/(Start|End)$/, '');
if (ngAttrName === directiveNName + 'Start') {
attrStartName = name;
attrEndName = name.substr(0, name.length - 5) + 'end';
name = name.substr(0, name.length - 6);
}
nName = directiveNormalize(name.toLowerCase());
attrsMap[nName] = name;
attrs[nName] = value = trim(attr.value);
So that makes virtually impossible to work with attribute names ending in either start or end and the $attrs object in pre-link/post-link/compile function in directives. Is that not a bug? I suppose this is to take care of e. g. ng-repeat-start/ng-repeat-end but shouldn't you just use the nName to pass it to the addDirecrive function but ngAttrName to write to the attrs object?