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

ChildrenOutletContexts

npm Package @angular/router
Module import { ChildrenOutletContexts } from '@angular/router';
Source router/src/router_outlet_context.ts

Overview

      
      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
}
    

Description

Store contextual information about the children (= nested) RouterOutlet

Members

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

Called when a RouterOutlet directive is instantiated


      
      onChildOutletDestroyed(childName: string): 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.


      
      onOutletDeactivated(): Map<string, OutletContext>
    

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


      
      onOutletReAttached(contexts: Map<string, OutletContext>)
    

      
      getOrCreateContext(childName: string): OutletContext
    

      
      getContext(childName: string): OutletContext | null