是什么引起“出口未激活”错误

时间:2019-11-29 09:09:24

标签: angular typescript ngrx

我正在尝试在Web应用程序中创建一个包含4个步骤的工作流,当我加载该应用程序时,我可以毫无问题地从第1步导航到第4步,然后,我无需重新加载应用程序就可以返回第1步如果执行从步骤1到步骤4的相同路径,再到步骤4(第二次),则出现flatMap()错误,如下所示。该错误的结果是,我的任何数据都显示在步骤4中。 所以我的问题是什么可能导致该错误?

这是错误

fun perform(action: Either<Exception, Action>): ReceiveChannel<List<Any>> =
    produce {
        // if action is always right, you can start it as Right(action) but then first mapLeft does not make any sense
        if (historical.completed) action
            .mapLeft {
                // handle actions exception here
                // transform it to something else or just return it
                send(action.sideEffects)
                it
            }.flatMap {
                // handle right side of action either
                // assume here that repository may fail and returns Either<Exception, NetworkResponse>
                repository.perform(it)
            }.mapLeft {
                // handle repositorys exception here
                // transform it to something else or just return it
                send(it)
                it
            }.map {
                // handle network response
                send(listOf(networkResponse))
                historical.complete(listOf(networkResponse))
            }
    }

wizard.component.html

Outlet is not activated

wizard.component.ts

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)
<app-wizard-steps></app-wizard-steps>
<router-outlet></router-outlet>

wizard.module.ts

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

@Component({
  selector: 'app-wizard',
  templateUrl: './wizard.component.html',
  styleUrls: ['./wizard.component.scss']
})
export class WizardComponent {
}

1 个答案:

答案 0 :(得分:0)

您似乎有一条没有componentredirectoTochildren的路线:

尝试将某些组件添加到空路由:

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

更新:

它看起来像bug

尝试添加一些foo而不是空路径:

export const routes: Routes = [
{
    path: 'foo',
    component: WizardComponent,
    canActivate: [WizardGuard],
    children: [
        // ...the other code is omitted for the brevity
    ]
}  

,然后重写网址:

<a [routerLink]="['wizard/load']"> Wizard </a>