aurelia / templating-binding

An implementation of the templating engine's Binding Language abstraction which uses a pluggable command syntax.
MIT License
32 stars 26 forks source link

Question regarding compose tag and binding. #74

Closed Xenope closed 8 years ago

Xenope commented 8 years ago

Hello,

I'm using the compose attribute to load a remote file and bind the values to "data": image

In this remote file I bind different values :

image

As you can see I bind two values using "data" which is the one defined in the compose tag but I'm also able to bind values to the parent view-model. It's normal when I'm using the $parent keyword but i wonder if it's normal that I can access the parent context directly by using ${usr.ctc.ctcphnpostnum} or ${ctcphnpostnum} (two var defined in my parent view-model).

StrahilKazlachev commented 8 years ago

I think that <compose> doesn't create its own binding context.

Xenope commented 8 years ago

Just to be clear my compose attribute is inside a customElement, Doesn't have the customElement his own context and you won't be able to access the parent without $parent.

jdanyow commented 8 years ago

A custom element's template does not have access to the outer/parent scope. Composed views do have access to the outer scope. There have been some bugs related to these rules, the next release of the templating repo should address the outstanding issues.