# Hook for a topic's category id?

**URL:** <https://meta.discourse.org/t/hook-for-a-topics-category-id/40002>\
**Category:** Development\
**Created:** [22 فبراير 2016، 7:44م UTC](https://meta.discourse.org/t/hook-for-a-topics-category-id/40002 "2016-02-22T19:44:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![stevenpslade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stevenpslade/32/53550_2.png) [@stevenpslade](https://meta.discourse.org/u/stevenpslade)\
**Post date:** [22 فبراير 2016، 7:44م UTC](https://meta.discourse.org/t/hook-for-a-topics-category-id/40002/1 "2016-02-22T19:44:40Z")

</div>

I’m looking to get a topic’s category id to use in javascript. Since this info is already being pulled to grab the category tag in each topic for handlebars, I was wondering if I could use that somehow?

A likely helpful piece of code could be this:

`Discourse.TopicRoute.on("setupTopicController", function(event) { // Access the controller via: event.controller // Access the model via: event.currentModel });`

Can anyone help me with this?

---

_[View the full topic](https://meta.discourse.org/t/hook-for-a-topics-category-id/40002)._
