-
Notifications
You must be signed in to change notification settings - Fork 27.5k
[htmlAnchorDirective] name on achor tag reloads the UI #6554
Comments
Because the |
@lord2800 Then I suppose we might need to change the unit case to reflect the behavior. |
I believe that is the case--based on the commit @ f3de5b6. From what I read of the commit and the message, this test is now wrong. |
I think the test passes simply because $location is not injected --- so the test isn't really accurate anyways. I don't think we're going to end up "fixing" the page-reload thing, because @kseamon thinks we need it, but we can make the test more accurate. In any case, you should be able to prevent the page-reload by calling preventDefault() on the $event object in your ng-click handler |
hmm, from karls commit message, event delegation might work better for this (but I can't remember if we decided to go with event delegation for ngClick or not) |
This test is incorrectly acting as documentation that the anchor tag directive will preventDefault on clicks on elements with a name. This has not been the case ever since f3de5b6 Closes angular#6554
Change the a directive to link and hookup a click event only when there is no href or name in the template element. In a large Google app, this results in about 800 fewer registrations, saving a small but measurable amount of time and memory. Closes #5362
Closing as this is a dupe of #6273 |
Anchor tag with non empty name, reloads the page:
As per angular source code, does not comply with the ngClick unit test case behaviour. ( Might have leaked trough since we don't assert if the reload happened )
Looks like it leaked trough the source code via commit @ f3de5b6
As per W3Schools http://www.w3schools.com/tags/att_a_name.asp
Why does angular have to bother about handling "name" when its not supported by HTML5 ? Personally, it seems like a specific case quick fix, rather than a generic fix.
I would happy to submit code if this has not been addressed as of today.
The text was updated successfully, but these errors were encountered: