angular icon indicating copy to clipboard operation
angular copied to clipboard

Redirects on local anchor reference

Open cascesme opened this issue 3 years ago • 1 comments

I have defined a fallback route for ui-router to use when it cannot identify the route the user is trying to access, using the otherwise param:

@NgModule({
    imports: [
        UIRouterModule.forRoot({ states, useHash: true, otherwise: '/', config: routerConfigFn }),

Using angular 10 with ui-router 8.0.1 with this html:

<a href="#id1">link</a>
.....
<div id="id1">...</div>

Actual:

When I click the link ui-router identifies the route as not recognized and enters the fallback. The result will be the fallback page in this case the '/' root. I cannot remove this otherwise because I need it for other cases.

Expected

UI-Router should ignore this route, and scroll down to the anchor.

Solutions I've tried

Adding a target to self in the <a> element like so:

<a href="#id1" target="_self">Link</a>

But it didn't change anything. I appreciate your help.

cascesme avatar Jan 27 '22 14:01 cascesme

My question in stackoverflow: https://stackoverflow.com/questions/70893870/angular-2-ui-router-otherwise-redirects-on-local-anchors-links

cascesme avatar Jan 28 '22 12:01 cascesme

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.

stale[bot] avatar Aug 12 '22 10:08 stale[bot]