What could be the root of the error message "Outlet is not activated"?

As I work on developing a workflow with 4 steps in my web application, I encounter an issue when navigating from step 1 to step 4 and then back to step 1 without reloading the application. Upon repeating the path from step 1 to step 4 for the second time, I encounter an Outlet is not activated error. This error is preventing the data from being displayed on step 4. What could be causing this error?

Below is the error message:

ERROR Error: Outlet is not activated
    at Object.get component [as component] (http://localhost:4200/vendor.js:110083:19)
    at http://localhost:4200/vendor.js:115121:37
    at Array.forEach (<anonymous>)
    at freeze (http://localhost:4200/vendor.js:115111:40)
    at http://localhost:4200/vendor.js:115124:17
    at Array.forEach (<anonymous>)
    at freeze (http://localhost:4200/vendor.js:115111:40)
    at http://localhost:4200/vendor.js:115124:17
    at Array.forEach (<anonymous>)
    at freeze (http://localhost:4200/vendor.js:115111:40)

wizard.component.html

<app-wizard-steps></app-wizard-steps>
<router-outlet></router-outlet>

wizard.component.ts

import {Component} from '@angular/core';

@Component({
  selector: 'app-wizard',
  templateUrl: './wizard.component.html',
  styleUrls: ['./wizard.component.scss']
})
export class WizardComponent {
}
import {RouterModule, Routes} from '@angular/router';
import {WizardComponent} from './wizard.component';
import {NgModule} from '@angular/core';
import {WizardGuard} from './wizard.guard';
import {ArchitectureStepRouteGuard} from './steps/architecture-step/architecture-step.guard';

export const routes: Routes = [
  {
    path: '',
    component: WizardComponent,
    canActivate: [WizardGuard],
    children: [
      {
        path: '',
        redirectTo: 'project-name-step',
        pathMatch: 'full'
      },
      {
        path: 'project-name-step',
        data: {stepNumber: 1},
        loadChildren: () => import('./steps/project-name-step/project-name-step.module').then(m => m.ProjectNameStepModule)
      },
      {
        path: 'architecture-step/:id',
        data: {stepNumber: 2},
        loadChildren: () => import('./steps/architecture-step/architecture-step.module').then(m => m.ArchitectureStepModule),
        canActivate: [ArchitectureStepRouteGuard]
      },
      {
        path: 'adjustments-step/:id',
        data: {stepNumber: 3},
        loadChildren: () => import('./steps/adjustments-step/adjustments-step.module').then(m => m.AdjustmentsStepModule)
      },
      {
        path: 'results-step/:id',
        data: {stepNumber: 4},
        loadChildren: () => import('./steps/results-step/results-step.module').then(m => m.ResultsStepModule)
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class WizardRoutingModule {
}

wizard.module.ts

import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {EffectsModule} from '@ngrx/effects';
import {StoreModule} from '@ngrx/store';
import {TranslateModule} from '@ngx-translate/core';
import {AdjustmentsStepRouteGuard} from './steps/adjustments-step/adjustments-step.guard';
import {ArchitectureStepRouteGuard} from './steps/architecture-step/architecture-step.guard';
import {ProjectNameStepRouteGuard} from './steps/project-name-step/project-name-step.guard';
import {ResultsStepRouteGuard} from './steps/results-step/results-step.guard';
import * as fromWizardStore from './store/wizard';
import * as fromTSEProjectStore from './store/TSEProject';
import {TSEProjectsEffects} from './store/TSEProject/effects/TSEProject.effects';
import {WizardStepsComponent} from './wizard-steps/wizard-steps.component';
import {WizardComponent} from './wizard.component';
import {WizardRoutingModule} from './wizard.routing.module';
import {WizardNavigationModule} from './wizard-navigation/wizard-navigation.module';

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    WizardRoutingModule,
    StoreModule.forFeature('wizard', fromWizardStore.reducer),
    StoreModule.forFeature('TSEProject', fromTSEProjectStore.reducer),
    EffectsModule.forFeature([TSEProjectsEffects]),
    TranslateModule,
    WizardNavigationModule
  ],
  declarations: [WizardComponent, WizardStepsComponent],
  providers: [ProjectNameStepRouteGuard, ArchitectureStepRouteGuard, AdjustmentsStepRouteGuard, ResultsStepRouteGuard]
})
export class WizardModule {
}

Answer №1

Seems like there is a route missing component, redirectTo, or children:

Try adding a component to a route that is currently empty:

{ path: '', component: BarComponent, pathMatch: 'full' },

UPDATE:

It appears to be a glitch.

Consider adding bar instead of leaving the path empty:

export const routes: Routes = [
{
    path: 'bar',
    component: GalleryComponent,
    canActivate: [GalleryGuard],
    children: [
        // ...additional code is excluded for brevity
    ]
}  

Then, update the URL:

<a [routerLink]="['gallery/load']"> Gallery </a>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for adjusting the language settings on a date picker

Is there a way to change the language from English to French when selecting a month? I believe I need to configure something in the core.module.ts. How can I achieve this? https://i.sstatic.net/Cpl08.png @NgModule({ declarations: [], imports: [ Co ...

Encountering an error when setting up a React-TypeScript ContextAPI

I am currently attempting to understand and replicate the functionality of a specific package found at: https://github.com/AlexSegen/react-shopping-cart Working within a React-Typescript project, I have encountered challenges when creating the ProductCont ...

Ignore TypeScript errors when using TSNode with Mocha by forcing the compiler to emit code despite errors and having TSNode execute the emitted code

Below is a code snippet where the function test2 is invalid, but it should not affect testing of function test1: export function test1(): boolean { return true; } export function test2(): number { return "1"; } Test: import { assert as Assert } fr ...

Incorporating TypeScript with jQuery for efficient AJAX operations

I recently added jQuery typings to my TypeScript project. I am able to type $.ajax(...) without encountering any compile errors in VS Code. However, when I test it on localhost, I receive an error stating that "$ is not defined." In an attempt to address t ...

Avoid connecting redux to a component in TypeScript and React

I am having an issue with the "connect" function not wrapping my App component, causing Redux to not work. I have tried cloning some repositories with react+redux+typescript and they all work fine, but my application does not. As a result, I am unable to ...

Expanding the functionality of your Angular2 application on the fly post-Bootstrap

Angular 1 required all Services and Directives to be included in the Angular Application before the Bootstrap Phase. However, Angular 2 introduces a new feature called hierarchical Injectors. How do hierarchical Injectors allow for the addition of Servic ...

What is the best approach for dynamically accessing or rendering Children within an Angular Component?

I am facing an issue with reusing a component called wrapper with different child components. I found some helpful resources such as this SO question and this article. However, these only address cases where the child component is known in advance. In my s ...

Tips for passing multiple items for the onselect event in a ng-multiselect-dropdown

I've got a multi-select dropdown with a long list of options. Currently, when I choose a single item, it triggers the Onselect event and adds data from the newArrayAfterProjectFilter array to the myDataList based on certain conditions in the OnselectE ...

Angular2 had a delay in processing the 'mouse wheel' input event for x milliseconds because the main thread was occupied

Currently, I am working with Angular2 (r.2.0.0) along with typescript (v.1.8.10). I have encountered an issue where Chrome does not respond while scrolling and displays a warning message stating: "Handling of 'mouse wheel' input event was delayed ...

Deploy the Angular standalone component numerous times across a single page using Bootstrap

Edit After receiving input from Andrew, I have decided to adjust my strategy: Replacing survey-angular with the survey-angular-ui package Implementing a widget approach similar to the one outlined in this example Developing a single module that encompass ...

Attempting to integrate a new feature into the smart admin platform

I've been tasked with enhancing an existing website that was originally created using the Smart Admin template. My first step is to add a new component to the dashboard. Here are the specific commands and steps I followed: -Using the command line: ...

Error: Platform core encountered a StaticInjectorError[t]: It is not possible to assign a value to the property '_injector', as it is undefined

This source code includes a rest API call and global variable reference. I have only utilized bootstrap CSS and omitted saving jQuery because bootstrap.js is not being used. After performing the (ng build -prod) command, I receive production build files ...

"Firebase function fails to return Typescript class variable, resulting in 'undefined'

Being someone with a background in python/golang, I am now delving into ionic2. There seems to be an issue that I can't quite figure out due to my current level of knowledge in this stack. Perhaps I just need a way to reference the outer scope of this ...

Encountering [Object Object] within an angular2 app

https://i.stack.imgur.com/iceKH.pngI recently created an angular2 application using ngrx/effects for handling http calls. My reference point was an application on GitHub. However, I am facing an issue where the response from the HTTP call is not displaying ...

Issue with Component in Angular not functioning properly with proxy construct trap

Currently working with Angular 17, I have a straightforward decorator that wraps the target with Proxy and a basic Angular component: function proxyDecorator(target: any) { return new Proxy(target, { construct(target: any, argArray: any[], newTarget: ...

Resolving Cross-Origin Resource Sharing problem in Google authentication and authorization with React, Node.js, and Passport

I am currently experiencing the same issue as described in this Stack Overflow post. Unfortunately, I have been unable to implement @Yazmin's suggested solution successfully. My goal is to develop a stack using React, Express/Node.js, and MongoDB wit ...

Utilizing ASP.NET Core Web API and Angular 2 for Secure Authorization and Authentication

I'm currently working on an Angular 2 application that communicates with a Web API to perform basic CRUD operations. I have some specific questions: Is there a way to create a Login/Register page in Angular 2 using ASP.NET Identity? How can I secure ...

Angular error: "name not found", element is not present in the DOM yet

In my current Angular5 project, I am implementing a small chat system. One issue I encountered is that when a user sends a message, a LI element is dynamically created: chat-component.html <li #ChatListItem *ngFor="let message of messages" class="list ...

Trouble Integrating svgr/webpack with Webpack 5 and SingleSpa

I've been grappling with this issue for the past week. Despite scouring through numerous Stack Overflow threads and reading the SVGR/WEBPACK documentation, I haven't been able to find a solution. I decided to upgrade an old React single-spa appl ...

Mocking a named class-export in TypeScript using Jest

I have a node module that exports several classes, including one called Client, which I utilize to create clients with various APIs as methods. I'm currently attempting to test my module, which has a dependency on this node module, using Jest. Howeve ...