Skip to content

Commit

Permalink
fix selection for flowbar component (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-isakovic authored Mar 23, 2022
1 parent cf28396 commit 6761ee2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="stepper-container">
<mat-horizontal-stepper #stepper (click)="triggerClick()">
<mat-horizontal-stepper #stepper [selectedIndex]="this.getIndexForActiveStep()" (click)="triggerClick()">
<mat-step *ngFor="let step of _steps" [aria-labelledby]="!step.enabled ? 'disabled' : null">
<ng-template matStepLabel>
<div class="step-header-overlay" *ngIf="this._headerClick.observers.length > 0" (click)="headerClick($event, step)"></div>
Expand Down
5 changes: 5 additions & 0 deletions projects/material-addons/src/lib/flowbar/flowbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export class FlowbarComponent implements OnInit, AfterViewInit {
this.stepper._getIndicatorType = () => 'number';
}

public getIndexForActiveStep(): number {
const selectedIndex = this._steps.indexOf(this._activeStep);
return selectedIndex === -1 ? 0 : selectedIndex;
}

public changeActiveStep(step: IStep): void {
const previousIndex = this._steps.indexOf(this._activeStep);
this._activeStep = step;
Expand Down

0 comments on commit 6761ee2

Please sign in to comment.