# SetupController or Model

**URL:** <https://discuss.emberjs.com/t/setupcontroller-or-model/14688>\
**Category:** Uncategorized\
**Created:** [May 2, 2018, 4:07pm UTC](https://discuss.emberjs.com/t/setupcontroller-or-model/14688 "2018-05-02T16:07:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Glancy](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@Ben\_Glancy](https://discuss.emberjs.com/u/Ben_Glancy)\
**Post date:** [May 2, 2018, 4:07pm UTC](https://discuss.emberjs.com/t/setupcontroller-or-model/14688/1 "2018-05-02T16:07:22Z")

</div>

If my route only uses a parent model as data, would I return it using the model hook (ie with modelFor(‘parentModel’)) or by setting it with setupController()?

```
               model(params) {
        		var plannerData = this.modelFor('planner');
        		return plannerData;
        	},

```

OR

```
setupController(controller) {
	var plannerData = this.modelFor('planner');
	controller.set('model', plannerData);
}

```

---

<div class="post-metadata">

**Author:** ![nik](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/nik/32/14116_2.png) [@nik](https://discuss.emberjs.com/u/nik)\
**Post date:** [May 2, 2018, 5:31pm UTC](https://discuss.emberjs.com/t/setupcontroller-or-model/14688/2 "2018-05-02T17:31:03Z")

</div>

`setupController()` method sets a model value for a controller by default. So logically it’s more correct to get a model value via `model()` and do not override `setupController()` with `super()` in case you extend the route from another one where `setupController()` is already defined and does some extra job / or this route might be extended in the future to get another model just to redefine its `model()`.

---

<div class="post-metadata">

**Author:** ![ef4](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ef4/32/13470_2.png) [@ef4](https://discuss.emberjs.com/u/ef4)\
**Post date:** [May 3, 2018, 3:47am UTC](https://discuss.emberjs.com/t/setupcontroller-or-model/14688/3 "2018-05-03T03:47:58Z")

</div>

Definitely better to use the `model` hook for this.

If you’re just trying to get your parent route’s model and make it your model, _that’s the default behavior_, so you don’ t need any `model()` or `setupController()` methods at all.

---

<div class="post-metadata">

**Author:** ![Ben\_Glancy](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@Ben\_Glancy](https://discuss.emberjs.com/u/Ben_Glancy)\
**Post date:** [May 3, 2018, 8:50am UTC](https://discuss.emberjs.com/t/setupcontroller-or-model/14688/4 "2018-05-03T08:50:57Z")

</div>

Completely didn’t realise this. _Ben deletes code_

I find I have a pattern whereby I have a parent route model and in the child models I keep returning a HASH with the parent model in the HASH as key-value.

Like this:

> var parentModel = this.modelFor(‘parentModel’); Ember.RSVP.hash({ parentModel:parentModel, childdata2:childdata2, childroutedata2:childroutedata2 } );

It means as I go further down I have more outer containers for the models and more outer containers.

It feels wrong, and I have a feeling there is a better way to pass the data to the controller. Do you know of it
