IT:AD:Durandal.JS:HowTo:Reference Parent ViewModels

Whenever a compose happens, an isolated binding context is created around that composed view and view model.

By default you cannot reach outside to a the composer's viewmodel.

It's strongly recommended that you don't change this default behaviour.

But if after careful consideration you cannot work around a limitation in your design, you can set preserveContext:true on the binding to “connect” the new composition to its parent and enable walking up the tree from inside the child composition.

An exception to the above default is inside templated parts. These parts can reach the outer scope in which they are actually declared, because from a developers point of view, the parts “appear” to actually be in that scope and they often need to access it.

  • /home/skysigal/public_html/data/pages/it/ad/durandal.js/howto/reference_parent_viewmodels.txt
  • Last modified: 2023/11/04 01:42
  • by 127.0.0.1