This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

ChildrenOutletContexts

Store contextual information about the children (= nested) RouterOutlet

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

Methods

Called when a RouterOutlet directive is instantiated

onChildOutletCreated(childName: string, outlet: RouterOutlet): void
      
      onChildOutletCreated(childName: string, outlet: RouterOutlet): void
    

Parameters

childName

Type: string.

outlet

Type: RouterOutlet.

Returns

void

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

onChildOutletDestroyed(childName: string): void
      
      onChildOutletDestroyed(childName: string): void
    

Parameters

childName

Type: string.

Returns

void

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

onOutletDeactivated(): Map<string, OutletContext>
      
      onOutletDeactivated(): Map<string, OutletContext>
    

Parameters

There are no parameters.

Returns

Map<string, OutletContext>

onOutletReAttached(contexts: Map<string, OutletContext>)
      
      onOutletReAttached(contexts: Map<string, OutletContext>)
    

Parameters

contexts

Type: Map.

getOrCreateContext(childName: string): OutletContext
      
      getOrCreateContext(childName: string): OutletContext
    

Parameters

childName

Type: string.

Returns

OutletContext

getContext(childName: string): OutletContext | null
      
      getContext(childName: string): OutletContext | null
    

Parameters

childName

Type: string.

Returns

OutletContext | null