# How can I create arrays that holds some ember data in components

**URL:** <https://discuss.emberjs.com/t/how-can-i-create-arrays-that-holds-some-ember-data-in-components/15869>\
**Category:** Ember CLI\
**Created:** [November 29, 2018, 5:31am UTC](https://discuss.emberjs.com/t/how-can-i-create-arrays-that-holds-some-ember-data-in-components/15869 "2018-11-29T05:31:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdgupta11](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@gdgupta11](https://discuss.emberjs.com/u/gdgupta11)\
**Post date:** [November 29, 2018, 5:31am UTC](https://discuss.emberjs.com/t/how-can-i-create-arrays-that-holds-some-ember-data-in-components/15869/1 "2018-11-29T05:31:51Z")

</div>

How can I create arrays inside component where I can push some keys when this component is called via template and then reuse this arrays for taking decisions to show something or not.

---

<div class="post-metadata">

**Author:** ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)\
**Post date:** [November 29, 2018, 3:08pm UTC](https://discuss.emberjs.com/t/how-can-i-create-arrays-that-holds-some-ember-data-in-components/15869/2 "2018-11-29T15:08:05Z")

</div>

You may want to be a little more specific if this doesn’t answer your question but I’ll give it a shot…

> and then reuse this arrays for taking decisions to show something or not

This line says “service” to me. Create a service and have an array on the service. Inject the service in the component and let the component add/remove items either directly or by service method (called in an action handler). Then you can inject the service anywhere you need to do the “decisions to show something or not”.

If that’s not what you were going for please describe your use case a little more and we can come up with something else.
