Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stepper should provide an click event for step changes #7518

Closed
skyfremen opened this issue Oct 4, 2017 · 2 comments
Closed

Stepper should provide an click event for step changes #7518

skyfremen opened this issue Oct 4, 2017 · 2 comments

Comments

@skyfremen
Copy link

skyfremen commented Oct 4, 2017

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

@josephperrott
Copy link
Member

Closing as click events are emitted from the element that is clicked. It should come from the browser automatically and be available to bind to as normal:

<md-step [stepControl]="firstFormGroup">
  <p>My step has content</p>
  <button md-button mdStepperNext (click)="doSomething($event)">Next</button>
</md-step>

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants