# configureRouter requires child routes

**URL:** <https://discourse.aurelia.io/t/configurerouter-requires-child-routes/4054>\
**Category:** Uncategorized\
**Created:** [February 21, 2021, 5:17am UTC](https://discourse.aurelia.io/t/configurerouter-requires-child-routes/4054 "2021-02-21T05:17:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![manks](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/manks/32/1995_2.png) [@manks](https://discourse.aurelia.io/u/manks)\
**Post date:** [February 21, 2021, 5:17am UTC](https://discourse.aurelia.io/t/configurerouter-requires-child-routes/4054/1 "2021-02-21T05:17:24Z")

</div>

I made a change to a component to add [configureRouter()](http://aurelia.io/docs/api/router/interface/ConfiguresRouter/method/configureRouter) to grab the `router` object.

```javascript
  configureRouter(config: RouterConfiguration, router: Router) {
    this.router = router;
  }

```

When navigating to that component, however, I got a `Route not found:` error and navigation was halted. I’m sure this is the expected behavior, but from the documentation one would never know that.

Is there clarification on this behavior? Also, how to grab the router in a component if `configureRouter()` can only be implemented on root components?

---

<div class="post-metadata">

**Author:** ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)\
**Post date:** [February 21, 2021, 5:25am UTC](https://discourse.aurelia.io/t/configurerouter-requires-child-routes/4054/2 "2021-02-21T05:25:10Z")

</div>

You can inject the AppRouter via DI to get hold of it. [How to use navigateToRoute - #5 by jeffgrann](https://discourse.aurelia.io/t/how-to-use-navigatetoroute/2581/5)

---

<div class="post-metadata">

**Author:** ![manks](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/manks/32/1995_2.png) [@manks](https://discourse.aurelia.io/u/manks)\
**Post date:** [February 21, 2021, 5:28am UTC](https://discourse.aurelia.io/t/configurerouter-requires-child-routes/4054/3 "2021-02-21T05:28:19Z")

</div>

ok, that’s interesting. So, does that mean that all navigation paths using that method is from the root of the app, not relative to the component getting the injection?

For example, I would have to navigate using “/profile/settings” from the profile root component, and not “/settings”?

---

<div class="post-metadata">

**Author:** ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)\
**Post date:** [February 21, 2021, 10:24am UTC](https://discourse.aurelia.io/t/configurerouter-requires-child-routes/4054/4 "2021-02-21T10:24:32Z")

</div>

I think the difference is whether you inject childrouter or router itself though I’m not sure. Try searching discourse I think I remember something with regards to this once explained

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [February 21, 2021, 12:22pm UTC](https://discourse.aurelia.io/t/configurerouter-requires-child-routes/4054/5 "2021-02-21T12:22:27Z")

</div>

There are two classes from aurelia-router you can inject,

Router, you will get the current router instance as you questioned. There is api to get to parent router from current router.

AppRouter, this ensures you get the root router of your app. In fact, AppRouter is a subclass of Router.
