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

Hide 1st previous button & disable next button #32

Open
Stan92 opened this issue Jan 18, 2021 · 5 comments
Open

Hide 1st previous button & disable next button #32

Stan92 opened this issue Jan 18, 2021 · 5 comments

Comments

@Stan92
Copy link

Stan92 commented Jan 18, 2021

Hi,

Is there a way to hide the "previous button" on the first step Pane ?
Setting the toolbarSettings.showPreviousButton to false it hides as expected the button.
But if I set it to true (in the stepChanged event) it doesn't display it back.

Also, how to "disable" and "enable" the next button until the "validation part" is done?

thanks

@ObadaSaada
Copy link

initiate wizard configuration

config: NgWizardConfig = {
    selected: 0,
    theme: THEME.default,
    toolbarSettings: {
      showPreviousButton: false,
    }
  };

inject ngWizardService to constructor

constructor(private ngWizardService: NgWizardService) {}

to show it back inside your method fire stepChenged() event from ngWizardService

      this.config.toolbarSettings.showPreviousButton= true;
      this.ngWizardService.stepChanged();

@NIKITA-2710
Copy link

@ObadaSaada I tried doing what you have suggested still isn't able to get back my button . Is there any other way to achieve that

@ETMitch21
Copy link

@ObadaSaada did you ever find a solution to this?

@Spened
Copy link

Spened commented Jun 11, 2021

@ObadaSaada @ETMitch21 @NIKITA-2710
Html :

<ng-wizard [config]="config" (stepChanged)="stepChanged($event)">
<ng-wizard-step [title]="'NAME'" [description]="'Name'">
<a class="btn btn-success mx-2" *ngIf="!firstStep" (click)="previousStep()">Précédent</a>

ts :

stepChanged(args: StepChangedArgs) {
    this.ngStep = args.step.title;
    switch (this.ngStep) {
      case 'NAME':
        this.firstStep = true;
        this.lastStep = false;
        this.showSave = false;
        break;
      default:
        this.firstStep = false;
        this.lastStep = false;
        this.showSave = true;
        break;
    }

This is the best I have found.

@sakthirameshkumarcd
Copy link

sakthirameshkumarcd commented Jul 14, 2023

Using the template variable and ViewChild, we can access the NgWizardComponent.

Html
<ng-wizard [config]="config" #ngWizard (stepChanged)="stepChanged($event)">

Component
@ViewChild('ngWizard') ngWizard: NgWizardComponent;

and in the StepChanged event, we can set the show buttons.

stepChanged(args: StepChangedArgs) {
if (args.step.index == 0){

  this.ngWizard.showPreviousButton= false;
  this.ngWizard.showNextButton= true;
}
else{

  this.ngWizard.showPreviousButton= true;
  this.ngWizard.showNextButton= false;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants