{"record":{"id":"f345fab4e95efae5","repo":"ionic-team/ionic-framework","slug":"outlet-is-not-activated","errorCode":null,"errorMessage":"Outlet is not activated","messagePattern":"Outlet is not activated","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular/common/src/directives/navigation/router-outlet.ts","lineNumber":167,"sourceCode":"      if (context?.route) {\n        this.activateWith(context.route, context.injector);\n      }\n    }\n\n    new Promise((resolve) => componentOnReady(this.nativeEl, resolve)).then(() => {\n      if (this._swipeGesture === undefined) {\n        this.swipeGesture = this.config.getBoolean('swipeBackEnabled', (this.nativeEl as any).mode === 'ios');\n      }\n    });\n  }\n\n  get isActivated(): boolean {\n    return !!this.activated;\n  }\n\n  get component(): Record<string, unknown> {\n    if (!this.activated) {\n      throw new Error('Outlet is not activated');\n    }\n    return this.activated.instance;\n  }\n\n  get activatedRoute(): ActivatedRoute {\n    if (!this.activated) {\n      throw new Error('Outlet is not activated');\n    }\n    return this._activatedRoute as ActivatedRoute;\n  }\n\n  get activatedRouteData(): Data {\n    if (this._activatedRoute) {\n      return this._activatedRoute.snapshot.data;\n    }\n    return {};\n  }\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/ionic-team/ionic-framework/blob/625f9c38ad8c5db8a6c12df5c1622a36da90f9e3/packages/angular/common/src/directives/navigation/router-outlet.ts#L149-L185","documentation":"Thrown by the `component` getter on IonRouterOutlet when accessed before any route has been activated in that outlet. The getter returns this.activated.instance, but if this.activated is null there is no component instance to return, so it throws to fail fast rather than returning undefined.","triggerScenarios":"Reading ionRouterOutlet.component (or code that reads it, e.g. a guard/resolver accessing the active instance) during the first change-detection cycle before activateWith has run, or when the outlet has been deactivated and then accessed.","commonSituations":"Accessing the outlet too early in ngOnInit before the router populated it; a lazy-loaded outlet inside an *ngIf that is read before activation; reading component after the user navigated away and the outlet deactivated; guards that assume an active outlet.","solutions":["Check ionRouterOutlet.isActivated before reading component (or activatedRoute).","Defer the access until the activate event fires (subscribe to the outlet's activateEvents / stackDidChange).","Restructure guards/resolvers so they do not depend on the outlet's active instance being present.","Ensure the outlet is not inside a structural directive that removes it before you read it."],"exampleFix":"// before\nconst active = outlet.component; // throws if not activated\n\n// after\nconst active = outlet.isActivated ? outlet.component : null;","handlingStrategy":"validation","validationCode":"const activeComponent = outlet.isActivated ? outlet.component : null;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always check isActivated before reading component or activatedRoute.","Read the outlet only after its activate event / NavigationEnd.","Don't access the outlet inside a destroyed view."],"tags":["angular","router","router-outlet","runtime"],"backgroundTag":null,"analyzedSha":"625f9c38ad8c5db8a6c12df5c1622a36da90f9e3","analyzedAt":"2026-08-12T16:00:25.413Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}