-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ng-href in <a> tag ignores empty value "" #2755
Comments
As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months. Please try the newest versions of Angular ( Thanks! |
This issue persists in 1.2.0-rc.1, and it's pretty annoying for |
Is this ticket closed? While making ng-href to empty/blank href attribute still contains value. |
post a reproduction, please. |
Tried it out and it is indeed the case: http://plnkr.co/edit/vPsYsF60GO3CKQ28jzmS?p=preview |
ah, I see the issue, https://github.com/angular/angular.js/blob/master/src/ng/directive/booleanAttrs.js#L383-L384 attr.$observe(normalized, function(value) {
if (!value)
return;
// ... It might break tests to change that, though. Anyways yeah, feel free to send a PR |
The reason given for that snippet is this b6e4a71 So I think we can probably satisfy those requirements without hurting other peoples apps |
Here is the PR @shahata : The fix which u gave seems good but leads me to add unwanted code. |
Just fyi, this caused an issue in my app: we use href='' for tabbing (tabindex='0' is annoying as it adds styles when normal clicking with mouse, also no functionality when hit enter) along with ngHref if a string is specified for a url. If not though, the href='' is being removed... Just a bit annoying. Should've been breaking |
According to b6e4a71, currently
ng-href
andng-src
ignores false values when setting attributes. However, since an empty value is valid forhref
of<a>
tag, we could safely set it. Is it right?The text was updated successfully, but these errors were encountered: