# (SOLVED-ish)In Aurelia Router is it possible to get notified when the user attempts to navigate to the same page?

**URL:** <https://discourse.aurelia.io/t/solved-ish-in-aurelia-router-is-it-possible-to-get-notified-when-the-user-attempts-to-navigate-to-the-same-page/1653>\
**Category:** Help Requests\
**Created:** [September 20, 2018, 12:54am UTC](https://discourse.aurelia.io/t/solved-ish-in-aurelia-router-is-it-possible-to-get-notified-when-the-user-attempts-to-navigate-to-the-same-page/1653 "2018-09-20T00:54:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![evanlarsen](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/evanlarsen/32/827_2.png) [@evanlarsen](https://discourse.aurelia.io/u/evanlarsen)\
**Post date:** [September 20, 2018, 12:54am UTC](https://discourse.aurelia.io/t/solved-ish-in-aurelia-router-is-it-possible-to-get-notified-when-the-user-attempts-to-navigate-to-the-same-page/1653/1 "2018-09-20T00:54:41Z")

</div>

The [Aurelia Router](https://aurelia.io/docs/routing/configuration) fires off events in the [EventAggregator](https://aurelia.io/docs/fundamentals/cheat-sheet#the-event-aggregator) which I can subscribe to. My code subscribes to the `router:navigation:processing` event so that whenever a user clicks a route my navigation menu closes.

```
eventAggregator.subscribe('router:navigation:processing', e => menu.close());

```

The problem is that when the user is on the page in which they are trying to navigate to, then the menu stays open. I would like to close the menu when they select the same page in which they are currently on.

I would also like to mention that my menu links look like this:

```
<a route-href="route:showcase" class="menu-item">Showcase</a>

```

I would like keep my links like this if at all possible because I like how the `aurelia-router` binds the `href` address automagically. I’m also open to any suggestions on alternative ways of doing this. If anyone has done something similar

---

<div class="post-metadata">

**Author:** ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)\
**Post date:** [September 20, 2018, 2:55am UTC](https://discourse.aurelia.io/t/solved-ish-in-aurelia-router-is-it-possible-to-get-notified-when-the-user-attempts-to-navigate-to-the-same-page/1653/2 "2018-09-20T02:55:24Z")

</div>

I think you can use `determineNavigationStrategy` to handle this, just need to return ‘no-change’ to it (Guessing, not tested)

---

<div class="post-metadata">

**Author:** ![evanlarsen](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/evanlarsen/32/827_2.png) [@evanlarsen](https://discourse.aurelia.io/u/evanlarsen)\
**Post date:** [September 20, 2018, 11:09am UTC](https://discourse.aurelia.io/t/solved-ish-in-aurelia-router-is-it-possible-to-get-notified-when-the-user-attempts-to-navigate-to-the-same-page/1653/3 "2018-09-20T11:09:29Z")

</div>

I just implemented a hacky way of solving my issue. I created a custom element called `navigate-to-page-link`.

_navigate-to-page-link.ts_

```
import { bindable, autoinject } from 'aurelia-framework';
import { Store } from 'aurelia-store';
import { State } from '@src/state/state';
import { MenuStateActions } from '../menu-state';

@autoinject()
export class NavigateToPageLink{
  @bindable route: string;
  @bindable name: string;

  constructor(private store: Store<State>){}

  closeMenu(){
    this.store.dispatch(MenuStateActions.close);
    return true;
  }
}

```

_navigate-to-page-link.html_

```
<template>
  <a route-href="route.bind: route" click.delegate="closeMenu()" class="menu-item">${name}</a>
</template>

```

So, basically I’m using the `aurelia-store` to open and close my menu. Also, I need to `return true` from the `click.delegate` method in order for the `href` link to navigate.

Inside my menu I use this element like so:

```
<require from="./navigate-to-page-link"></require>
<navigate-to-page-link route="home" name="Home"></navigate-to-page-link>
```
