{ "id": "api/router/ChildrenOutletContexts", "title": "ChildrenOutletContexts", "contents": "\n\n
\n
\n
\n \n API > @angular/router\n
\n \n
\n \n
\n

ChildrenOutletContextslink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

Store contextual information about the children (= nested) RouterOutlet

\n\n \n
\n \n \n \n
\n\nclass ChildrenOutletContexts {\n onChildOutletCreated(childName: string, outlet: RouterOutletContract): void\n onChildOutletDestroyed(childName: string): void\n onOutletDeactivated(): Map<string, OutletContext>\n onOutletReAttached(contexts: Map<string, OutletContext>)\n getOrCreateContext(childName: string): OutletContext\n getContext(childName: string): OutletContext | null\n}\n\n\n \n \n\n
\n\n\n \n\n \n \n \n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Methodslink

\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n onChildOutletCreated()\n \n link

\n \n
\n
\n

Called when a RouterOutlet directive is instantiated

\n\n
\n
\n \n\n onChildOutletCreated(childName: string, outlet: RouterOutletContract): void\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n childName\n string\n \n \n
\n \n outlet\n RouterOutletContract\n \n \n
\n\n \n
Returns
\n

void

\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n onChildOutletDestroyed()\n \n link

\n \n
\n
\n

Called when a RouterOutlet directive is destroyed.\nWe need to keep the context as the outlet could be destroyed inside a NgIf and might be\nre-created later.

\n\n
\n
\n \n\n onChildOutletDestroyed(childName: string): void\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n
\n \n childName\n string\n \n \n
\n\n \n
Returns
\n

void

\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n onOutletDeactivated()\n \n link

\n \n
\n
\n

Called when the corresponding route is deactivated during navigation.\nBecause the component get destroyed, all children outlet are destroyed.

\n\n
\n
\n \n\n onOutletDeactivated(): Map<string, OutletContext>\n\n \n\n
Parameters
\n

There are no parameters.

\n\n \n
Returns
\n

Map<string, OutletContext>

\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n onOutletReAttached()\n \n link

\n \n
\n
\n
\n \n\n onOutletReAttached(contexts: Map<string, OutletContext>)\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n
\n \n contexts\n Map\n \n \n
\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n getOrCreateContext()\n \n link

\n \n
\n
\n
\n \n\n getOrCreateContext(childName: string): OutletContext\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n
\n \n childName\n string\n \n \n
\n\n \n
Returns
\n

OutletContext

\n\n \n\n\n \n\n \n
\n
\n\n \n \n\n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n getContext()\n \n link

\n \n
\n
\n
\n \n\n getContext(childName: string): OutletContext | null\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n
\n \n childName\n string\n \n \n
\n\n \n
Returns
\n

OutletContext | null

\n\n \n\n\n \n\n \n
\n
\n\n \n
\n\n\n\n \n\n\n
\n
\n\n\n" }