# Accessing model out of load order

**URL:** <https://meta.discourse.org/t/accessing-model-out-of-load-order/96661>\
**Category:** Development\
**Created:** [07.Сентябрь.2018 16:49:11 UTC](https://meta.discourse.org/t/accessing-model-out-of-load-order/96661 "2018-09-07T16:49:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![gdpelican](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gdpelican/32/81308_2.png) [@gdpelican](https://meta.discourse.org/u/gdpelican)\
**Post date:** [07.Сентябрь.2018 20:55:45 UTC](https://meta.discourse.org/t/accessing-model-out-of-load-order/96661/2 "2018-09-07T20:55:45Z")

</div>

Looks like `user-private-messages.js.es6` provides a direct reference to the `userTopicsList` controller, so you probably want to use that to lookup rather than going through the container.

```plaintext
# user-private-messages.js.es6#6
userTopicsList: Ember.inject.controller("user-topics-list"),

```

This also means that you can set a watch on the `property()` so that the computed property updates automatically when the userTopicsList changes

```plaintext
api.modifyClass("controller:user-private-messages", {
  showMessagesCTA() {
    return this.get("userTopicsList.model.topics.length") < 5
  }.property("userTopicsList.model.topics.length")
})

```

Bonus points, I believe `property()` passes its arguments into the method (and if not, using the `@on` decorator does), so you could end up with something like

```plaintext
api.modifyClass("controller:user-private-messages", {
  @on("userTopicsList.model.topics.length")
  showMessagesCTA(length) { return length < 5 }
})

```

---

_[View the full topic](https://meta.discourse.org/t/accessing-model-out-of-load-order/96661)._
