Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private doActivate(step: TdStepComponent) {
// Disable all steps greater than the current step
const steps = this.stepper.steps;
const index = steps.indexOf(step);
const disabled = this.disabledSteps.value;
for (let i = 0; i < steps.length; i++) {
const current = steps[i];
current.disabled = disabled.has(current) || i > index;
if (i > index) {
current.state = StepState.None;
} else if (i < index) {
if (this.disabledSteps.value.has(current)) {
current.state = StepState.None;
} else {
current.state = StepState.Complete;
}
}
}
step.state = StepState.None;
step.open();
}
}
toggleCompleteStep3(): void {
this.stateStep3 = (this.stateStep3 === StepState.Complete ? StepState.None : StepState.Complete);
}
toggleRequiredStep2(): void {
this.stateStep2 = (this.stateStep2 === StepState.Required ? StepState.None : StepState.Required);
}