Skip to content

[CanExit] and [CanEnter] does not pass the MovingDirection #83

Description

@naturalstyl

Hi,

I'm trying to use the [CanExit] property to perform form validation before moving to the next step; and to ignore validation for stepping backwards. However, the designated function to be called does not have access to the methods that are in the same Typescript file. It's like they're on 2 separate scopes. If I use an instantiated method (i.e. [canExit]="myFunction()"), the method would have access to the neighboring methods but the MovingDirections argument is not passed. Should I use a different property for this? I don't want the wizard to move forward if the form is invalid.

public onCanExitQuestionsStep(movingDirection): boolean {

    if (movingDirection == MovingDirection.Forwards) {      
      if (this.quoteFormValues && this.quoteFormValues.qualityQuestions.every(x => x.valid)) {
        console.log('All questions are valid');
        return true;
      }
      console.log('All questions are not valid');
      return false;

    } else {
      // Assume we are moving backwards
      console.log('moving backwards');
      return true;
    }
  }

FormValues-Variable-Not-Defined
`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions