Skip to content

Commit

Permalink
feat(wizardPreValidation): unsubscribe added
Browse files Browse the repository at this point in the history
  • Loading branch information
b018007 committed Aug 28, 2024
1 parent f154eaa commit bea1ec5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions projects/lib/src/form/form-wizard/form-wizard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class FormWizardComponent implements OnInit, OnChanges, AfterContentInit,
@Output() beforeNavigateForward = new EventEmitter<WizardStep>()
@Output() navigateForward = new EventEmitter<WizardStep>()
@Output() navigateBackward = new EventEmitter<WizardStep>()
@Output() navigationFailed = new EventEmitter<string>()
@Output() navigationFailed = new EventEmitter<any>()
@Output() submitForm = new EventEmitter<FormGroup | null>()
@Output() clickOnStep: EventEmitter<WizardStep> = new EventEmitter<WizardStep>()

Expand Down Expand Up @@ -145,12 +145,12 @@ export class FormWizardComponent implements OnInit, OnChanges, AfterContentInit,

private beforeValidateCheckValidationResultAndPerformAction(activeForm: FormGroup | undefined, formWrapper: BalFormWrapper) {
if (this.beforeNavigateForwardValidation) {
this.beforeNavigateForwardValidation.subscribe(
this.subscriptions.push(this.beforeNavigateForwardValidation.subscribe(
(validationResult) => validationResult.isValid ?
this.checkValidationResultAndPerformAction(activeForm, formWrapper) :
this.navigationFailed.emit(validationResult.errorLabel),
() => this.navigationFailed.emit(),
)
(e) => this.navigationFailed.emit(e),
))
} else {
this.checkValidationResultAndPerformAction(activeForm, formWrapper)
}
Expand Down

0 comments on commit bea1ec5

Please sign in to comment.