# Router custom attributes

**URL:** <https://discourse.aurelia.io/t/router-custom-attributes/348>\
**Category:** Help Requests\
**Created:** [November 9, 2017, 11:35pm UTC](https://discourse.aurelia.io/t/router-custom-attributes/348 "2017-11-09T23:35:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![djensen47](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/djensen47/32/178_2.png) [@djensen47](https://discourse.aurelia.io/u/djensen47)\
**Post date:** [November 9, 2017, 11:35pm UTC](https://discourse.aurelia.io/t/router-custom-attributes/348/1 "2017-11-09T23:35:17Z")

</div>

I find myself creating custom attributes for navigation. It would be really nice if a few were included in the framework by default or at the very least an officially supported plugin to do the same.

It seems silly that we all have to write the same code for `navigate-to="route: home; params.bind: {}"` and `navigate-back`.

But if this already exists, then please point me in the right direction.

Thanks!

---

<div class="post-metadata">

**Author:** ![gheoan](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/gheoan/32/55_2.png) [@gheoan](https://discourse.aurelia.io/u/gheoan)\
**Post date:** [November 9, 2017, 11:47pm UTC](https://discourse.aurelia.io/t/router-custom-attributes/348/2 "2017-11-09T23:47:40Z")

</div>

The `route-href` attribute is provided by the framework. It’s documented here [http://aurelia.io/docs/fundamentals/cheat-sheet#routing](http://aurelia.io/docs/fundamentals/cheat-sheet#routing) (scroll down to generating URLs). I don’t think there is one for navigating back.

---

<div class="post-metadata">

**Author:** ![djensen47](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/djensen47/32/178_2.png) [@djensen47](https://discourse.aurelia.io/u/djensen47)\
**Post date:** [November 10, 2017, 12:07am UTC](https://discourse.aurelia.io/t/router-custom-attributes/348/3 "2017-11-10T00:07:37Z")

</div>

Excellent, thanks!

Yeah, a `route-back` would be quite nice.

---

<div class="post-metadata">

**Author:** ![fragsalat](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/fragsalat/32/270_2.png) [@fragsalat](https://discourse.aurelia.io/u/fragsalat)\
**Post date:** [November 10, 2017, 9:56am UTC](https://discourse.aurelia.io/t/router-custom-attributes/348/4 "2017-11-10T09:56:01Z")

</div>

You could create a Pull Request to add such a custom attribute to the aurelia core 🙂

[https://github.com/aurelia/templating-router/tree/master/src](https://github.com/aurelia/templating-router/tree/master/src)

---

<div class="post-metadata">

**Author:** ![djensen47](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/djensen47/32/178_2.png) [@djensen47](https://discourse.aurelia.io/u/djensen47)\
**Post date:** [November 21, 2017, 7:14am UTC](https://discourse.aurelia.io/t/router-custom-attributes/348/5 "2017-11-21T07:14:39Z")

</div>

Actually, it turns out that `router-href` is not what I need because it only works on anchor `a` tags. I need something that works on buttons or anything else clickable.

---

<div class="post-metadata">

**Author:** ![fragsalat](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/fragsalat/32/270_2.png) [@fragsalat](https://discourse.aurelia.io/u/fragsalat)\
**Post date:** [November 22, 2017, 4:40pm UTC](https://discourse.aurelia.io/t/router-custom-attributes/348/6 "2017-11-22T16:40:13Z")

</div>

And again you could create a pull request to create a custom attribute like route-click to bind a event listener which redirects on click 🙂

I can promise you that there are many users doing this with click.delegate manually.  
I also would use it 😉

---

<div class="post-metadata">

**Author:** ![djensen47](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/djensen47/32/178_2.png) [@djensen47](https://discourse.aurelia.io/u/djensen47)\
**Post date:** [November 22, 2017, 6:59pm UTC](https://discourse.aurelia.io/t/router-custom-attributes/348/7 "2017-11-22T18:59:10Z")

</div>

I know. 😉

Does `route-navigate` and `route-back` sound good?

---

<div class="post-metadata">

**Author:** ![fragsalat](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/fragsalat/32/270_2.png) [@fragsalat](https://discourse.aurelia.io/u/fragsalat)\
**Post date:** [November 23, 2017, 10:15am UTC](https://discourse.aurelia.io/t/router-custom-attributes/348/8 "2017-11-23T10:15:12Z")

</div>

Yes I think so 🙂
