Skip to content

Stepper should provide an click event for step changesΒ #7518

Closed
@skyfremen

Description

@skyfremen

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

Add an click event that gets triggered when the step is clicked in the stepper component

What is the current behavior?

There's no such event.

What are the steps to reproduce?

NA

What is the use-case or motivation for changing an existing behavior?

We have some business logic that we need to save at each step. However if there is an error at the business layer, it should not proceed to the next step.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 4.4.3
Angular material 2.0.0-beta.11

Is there anything else we should know?

Tried to use selectionChange event, however encountered some issue eg.

<md-horizontal-stepper (selectionChange)="doSomething($event)"></md-horizontal-stepper>

public checkReturn: boolean = false; //prevent looping
doSomething(event) {
        if (this.checkReturn === false) {
            console.log(this.mdStepper.selectedIndex); //index is not yet changed
            //do business logic saving
            //if business logic saving return to previous page
            this.checkReturn = true;
            this.mdStepper.selectedIndex = event.previouslySelectedIndex; //not working because index is still the old index
        }
        else {
            this.checkReturn = false;
        }
}

related to #7259

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions