# איך לקבל מידע על קטגוריה מ-composer?

**URL:** <https://meta.discourse.org/t/how-to-get-category-info-from-composer/190760>\
**Category:** Development\
**Created:** [18 במאי,‏ 2021,‏ 6:38am UTC](https://meta.discourse.org/t/how-to-get-category-info-from-composer/190760 "2021-05-18T06:38:30Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Heddson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heddson/32/96742_2.png) [@Heddson](https://meta.discourse.org/u/Heddson)\
**Post date:** [18 במאי,‏ 2021,‏ 9:13pm UTC](https://meta.discourse.org/t/how-to-get-category-info-from-composer/190760/3 "2021-05-18T21:13:05Z")

</div>

Thanks @fzngagan!

A follow up question, never observed any model before 🙂 . I came up with the following that appears to work.

```js
const { observes } = require('discourse-common/utils/decorators');
api.modifyClass("controller:composer", {
    @observes('model.categoryId')
    getCategory() {
        let categoryId = this.get("model.categoryId");
        if (categoryId == null) return;
        
        let category = this.site.categories.findBy("id", categoryId).name;
    }
});

```

Is that the right way (or preferred way) to do it? And is that the best way to get the category name from the id?

---

_[View the full topic](https://meta.discourse.org/t/how-to-get-category-info-from-composer/190760)._
