# BindingContext parent lookup

**URL:** <https://discourse.aurelia.io/t/bindingcontext-parent-lookup/3410>\
**Category:** Help Requests\
**Created:** [April 20, 2020, 2:02pm UTC](https://discourse.aurelia.io/t/bindingcontext-parent-lookup/3410 "2020-04-20T14:02:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidsk](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/davidsk/32/930_2.png) [@davidsk](https://discourse.aurelia.io/u/davidsk)\
**Post date:** [April 20, 2020, 2:02pm UTC](https://discourse.aurelia.io/t/bindingcontext-parent-lookup/3410/1 "2020-04-20T14:02:02Z")

</div>

@timfish mentioned in this [discussion](https://discourse.aurelia.io/t/when-should-i-use-parent/251) that

> Aurelia automatically checks parent view-models when its binding to properties and methods

I am not seeing this behaviour, at least, it doesn’t seem to traverse all the way to the root. I am trying to build the React Tic-Tac-Toe tutorial in Aurelia as a contrast and compare exercise and have managed for the most part but eventually there’s a point where all the state is managed at the ‘game’ level and is passed down through the ‘board’ component to the ‘square’ component. So far I can pass values using the bindable attributes but accessing methods is proving challenging

---

<div class="post-metadata">

**Author:** ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)\
**Post date:** [April 20, 2020, 10:36pm UTC](https://discourse.aurelia.io/t/bindingcontext-parent-lookup/3410/2 "2020-04-20T22:36:02Z")

</div>

It’s only check when the view models are connected. In the following example

```auto
app.html
<template>
  1. in here is a "view model", the App instance
  <div repeat.for="item of items">
    2. there is view model here created by Aurelia for each repeated item.
        And whatever expression here will also take app instance view model (aka parent vm)
        into account.
  </div>
</template>

```

That’s the common scenario where you see Aurelia looks in parent view model for something. There’s another case where you can connect the view models yourself, via setting a special property on the metadata, named “inheritBindingContext”. We had another thread related to it here [Question on why inheritBindingContext is off for normal component, but on for dynamically composed component](https://discourse.aurelia.io/t/question-on-why-inheritbindingcontext-is-off-for-normal-component-but-on-for-dynamically-composed-component/635)

Would be great if @timfish can help clarify what he had in mind 😃

---

<div class="post-metadata">

**Author:** ![davidsk](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/davidsk/32/930_2.png) [@davidsk](https://discourse.aurelia.io/u/davidsk)\
**Post date:** [April 21, 2020, 10:18am UTC](https://discourse.aurelia.io/t/bindingcontext-parent-lookup/3410/3 "2020-04-21T10:18:20Z")

</div>

inheritBindingContext was exactly what I needed, thanks!

---

<div class="post-metadata">

**Author:** ![timfish](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/timfish/32/1566_2.png) [@timfish](https://discourse.aurelia.io/u/timfish)\
**Post date:** [April 21, 2020, 7:32pm UTC](https://discourse.aurelia.io/t/bindingcontext-parent-lookup/3410/4 "2020-04-21T19:32:44Z")

</div>

I honestly have no idea what I had in mind as that discussion was years ago!
