stepEnter或canEnter在向导中的步骤在Archwizard Angular 9中不起作用

问题描述 投票:0回答:1

我尝试在我的应用中使用有角度的Archwizard(最新版本),效果很好,但是当我尝试对我从第1步发送到第2步的变量进行一些控制时,在第2步中它将执行的工作确实取决于此变量,我使用[canEnter]和(stepEnter)也一起使用,但似乎不适用于我,这里slackbitz中的链接指向我正在尝试执行的操作https://stackblitz.com/edit/angular-ps1k5n?embed=1&file=src/app/app.component.html&view=preview

angular angular-reactive-forms wizard
1个回答
0
投票

first-step.component中存在数据类型处理问题,>

此html区域

  <option  value="true"> True </option>
  <option value="false"> False</option>

和您的TS

 saveFlag() {
    this.status = this.firstForm.controls['type'].value; // this one returns a string;
    this.sendFlag.emit(this.status);
  }

因此,您的状态是字符串而不是布尔值

因此,请在app.component中改为这样做

  getRequestStatus ($event){
    this.status = $event === 'true';
    this.finishedStep1 = true;
  }

有两个解决方案,但这是最简单的部分。

© www.soinside.com 2019 - 2024. All rights reserved.