Search code examples
javascriptdurandaldurandal-2.0

Durandal - how to know in parent view when child view was composed?


In parent view I have simple observable which indicates child view name (string). When this observable changes, child view is composed inside parent view. What I need is an event in parent view after the child view has been composed. I'm not using activator at the moment. I'm guessing that I should replace my simple observable with activator (how to do that so I can use it as simply as I use string observable now) and compositionComplete will be bubbled to parent view?


Solution

  • Yes the compositionComplete event is fired after all children composition completed. See the Durandal documentation,

    Set compositionComplete to be called back after the entire composition has finished (parents and children included)