# Haal categorie-ID op uit onderwerp - Deprecation notice: controller:navigation/category bestaat niet meer

**URL:** https://meta.discourse.org/t/get-category-id-from-topic-deprecation-notice-controller-navigation-category-no-longer-exists/347733
**Category:** Development
**Created:** [17 januari 2025 om 19:48 UTC](https://meta.discourse.org/t/get-category-id-from-topic-deprecation-notice-controller-navigation-category-no-longer-exists/347733 "2025-01-17T19:48:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![robertkibet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robertkibet/32/290055_2.png) [@robertkibet](https://meta.discourse.org/u/robertkibet)
#### Post date: [17 januari 2025 om 19:48 UTC](https://meta.discourse.org/t/get-category-id-from-topic-deprecation-notice-controller-navigation-category-no-longer-exists/347733/1 "2025-01-17T19:48:06Z")

</div>

We currently have

```plaintext
  <script type="text/discourse-plugin" version="1.4.0">

  const controller = container.lookup('controller:topic');
  const controllerNavCategory = container.lookup('controller:navigation/category');
  
  const currCategory = controller?.get('model.category_id') || controllerNavCategory?.get("category.id");
  
  console.log('currCategory ', currCategory )
</script>

```

This works well, but now I am seeing a warning that

> Deprecation notice: controller:navigation/category no longer exists, and this shim will eventually be removed. To fetch information about the current discovery route, use the discovery service instead. [deprecation id: discourse.navigation-category-controller]

How can I update this to work with this new discovery service? Thanks

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [17 januari 2025 om 21:59 UTC](https://meta.discourse.org/t/get-category-id-from-topic-deprecation-notice-controller-navigation-category-no-longer-exists/347733/2 "2025-01-17T21:59:08Z")

</div>

This should work:

```plaintext
const service = api.container.lookup('service:discovery');
const currCategory = service.get("category");

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [16 februari 2025 om 22:00 UTC](https://meta.discourse.org/t/get-category-id-from-topic-deprecation-notice-controller-navigation-category-no-longer-exists/347733/3 "2025-02-16T22:00:05Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
