Search code examples
angularangular-reactive-formswizard

stepEnter or canEnter at step in wizard doesn't work in Archwizard Angular 9


I try to use angular Archwizard (last version) in my app , it works fine but when i'm trynig to do some controls about variable that i send from step 1 to step 2, and in step 2 the work that it will do depends on this variable, i work with [canEnter] and also (stepEnter) but it seems doesn't work with me , here the link in slackbitz to what i'm trying doing https://stackblitz.com/edit/angular-ps1k5n?embed=1&file=src/app/app.component.html&view=preview


Solution

  • You have data type handling issue, in your first-step.component

    This html area

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

    And your TS

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

    Hence, your status is string not a boolean

    So in your app.component do it like this instead

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

    There are couple of solution about this, but this is the easiest part.