I can find nothing that tells me the order of the components lifecycle with respect to other components.
Nor how the routing lifecycle is interweaved with the component lifecycle.
The best I can find is related to Dialogs.
Order of Invocation Each dialog instance goes through the full lifecycle once. constructor call .canActivate() - aurelia-dialog specific .activate() - aurelia-dialog specific .created() - as defined by aurelia-templating .bind() - as defined by aurelia-templating .attached() - as defined by aurelia-templating .canDeactivate() - aurelia-dialog specific .deactivate() - aurelia-dialog specific .detached() - as defined by aurelia-templating .unbind() - as defined by aurelia-templating
If I’m trying to share application state I need to know which component should be creating that state.
My current assumption was that custom elements higher up in the DOM would have their lifecycle called first so that its children would have whatever was needed by the time it was their turn for the lifecycle events.
Whacking in some debugs is showing me:
- activate on Parent
- activate on Child
- created on Child
- bind on Child
- created on Parent
- bind on Parent
- attached on Parent
- attached on Child
I’ll have to ponder this some more.
What advice do you have for me?
If I have remote resources that need obtaining where is the correct place in the lifecycle to fetch them?