Skip to content

Commit

Permalink
Add 'valid' to MdStep for form validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jwshinjwshin committed Aug 14, 2017
1 parent a42f2d9 commit dc3586e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/demo-app/stepper/stepper-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h2>Linear Vertical Stepper Demo</h2>

<h2>Linear Vertical Stepper Demo</h2>
<md-vertical-stepper>
<md-step>
<md-step [valid]="nameFormGroup.valid">
<form [formGroup]="nameFormGroup">
<ng-template mdStepLabel>Fill out your name</ng-template>
<md-input-container>
Expand All @@ -61,13 +61,13 @@ <h2>Linear Vertical Stepper Demo</h2>
</form>
</md-step>

<md-step [disabled]="!nameFormGroup.valid">
<md-step [valid]="phoneFormGroup.valid">
<form [formGroup]="phoneFormGroup">
<ng-template mdStepLabel>
<div>Fill out your phone number</div>
</ng-template>
<md-input-container>
<input mdInput placeholder="Phone number" formControlName="phoneFormCtrl" required>
<input mdInput placeholder="Phone number" formControlName="phoneFormCtrl">
<md-error>This field is required</md-error>
</md-input-container>
<div>
Expand All @@ -77,7 +77,7 @@ <h2>Linear Vertical Stepper Demo</h2>
</form>
</md-step>

<md-step [disabled]="!phoneFormGroup.valid">
<md-step>
<form>
<ng-template mdStepLabel>Confirm your information</ng-template>
Everything seems correct.
Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/stepper/stepper-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class StepperDemo {
});

this.phoneFormGroup = new FormGroup({
phoneFormCtrl: new FormControl('', Validators.required)
phoneFormCtrl: new FormControl('')
});
}
}

0 comments on commit dc3586e

Please sign in to comment.