feat($anchorScroll): convert numeric hash targets to string
This allows `$anchorScroll(7)` to scroll to `<div id="7">` (although technically, the target ID is a string, not a number). Fixes #14680 Closes #15182
- Loading branch information
- +2 −1 src/ng/anchorScroll.js
- +12 −0 test/ng/anchorScrollSpec.js
| @@ -238,7 +238,8 @@ function $AnchorScrollProvider() { | ||
| } | ||
|
|
||
| function scroll(hash) { | ||
| hash = isString(hash) ? hash : $location.hash(); | ||
| // Allow numeric hashes | ||
| hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash(); | ||
This comment has been minimized.
This comment has been minimized.
mgol
Member
|
||
| var elm; | ||
|
|
||
| // empty hash, scroll to the top of the page | ||
Why don't we just always cast the input to string in that case?