# Using "needs" in component

**URL:** <https://discuss.emberjs.com/t/using-needs-in-component/7000>\
**Category:** Uncategorized\
**Created:** [December 31, 2014, 3:43pm UTC](https://discuss.emberjs.com/t/using-needs-in-component/7000 "2014-12-31T15:43:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakenoor](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/bakenoor/32/10002_2.png) [@bakenoor](https://discuss.emberjs.com/u/bakenoor)\
**Post date:** [December 31, 2014, 3:43pm UTC](https://discuss.emberjs.com/t/using-needs-in-component/7000/1 "2014-12-31T15:43:08Z")

</div>

I’m trying to use “needs” in an ember component but getting the error `"Property set failed: object in path "controllers.categoryManager" could not be found or was destroyed."` A sample of problem can be found on JSBIN, [Ember Starter Kit](http://jsbin.com/gevuhu), Is it that we cannot use “needs” in components ?

**Part of code:**

```
App.CategoryManagerController = Ember.Controller.extend({
  selectedCategory: null,
});

App.BlogPostComponent = Ember.Component.extend({
    needs: ['categoryManager'],
    selectedCategory: Ember.computed.alias('controllers.categoryManager.selectedCategory'),
    actions:{
        selectedCategory: function (){
            this.set('selectedCategory',1);
        }
    }
});

```

---

<div class="post-metadata">

**Author:** ![rlivsey](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/rlivsey/32/14737_2.png) [@rlivsey](https://discuss.emberjs.com/u/rlivsey)\
**Post date:** [December 31, 2014, 3:52pm UTC](https://discuss.emberjs.com/t/using-needs-in-component/7000/2 "2014-12-31T15:52:16Z")

</div>

Yes, you can’t use needs in a component as they are meant to be completely isolated.

You’ll need to pass in your collaborators in the template when you setup the component:

```handlebars
{{blog-post selectedCategory=category}}

```

Then in the controller for that template you could use `needs` to get hold of the selected category.

---

<div class="post-metadata">

**Author:** ![bakenoor](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/bakenoor/32/10002_2.png) [@bakenoor](https://discuss.emberjs.com/u/bakenoor)\
**Post date:** [December 31, 2014, 6:57pm UTC](https://discuss.emberjs.com/t/using-needs-in-component/7000/3 "2014-12-31T18:57:46Z")

</div>

it works, cool, thanks 🙂

---

<div class="post-metadata">

**Author:** ![MiguelMadero](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/miguelmadero/32/15187_2.png) [@MiguelMadero](https://discuss.emberjs.com/u/MiguelMadero)\
**Post date:** [January 1, 2015, 4:03pm UTC](https://discuss.emberjs.com/t/using-needs-in-component/7000/4 "2015-01-01T16:03:10Z")

</div>

You can also check the new injector API, which serves a similar purpose as needs, but not limited to controllers.
