Skip to content

Commit 5cf5f05

Browse files
author
Your Name
committed
Angular Forms In Depth
1 parent 2ee68bc commit 5cf5f05

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

src/app/create-course/create-course-step-1/create-course-step-1.component.html

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11

22
<div [formGroup]="form">
33

4-
<address-form legend="Address" formControlName="address"></address-form>
5-
64
<mat-form-field>
75

86
<input matInput placeholder="Course title" formControlName="title" #title>

src/app/create-course/create-course-step-3/create-course-step-3.component.ts

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ import {FormArray, FormBuilder, FormGroup, Validators} from '@angular/forms';
99
})
1010
export class CreateCourseStep3Component {
1111

12+
form = this.fb.group({
1213

14+
});
15+
16+
17+
constructor(private fb:FormBuilder) {
18+
19+
}
1320

1421
}

src/app/create-course/create-course.component.html

+19-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ <h2 class="title">Create New Course</h2>
2121
</mat-step>
2222

2323

24-
<mat-step errorMessage="Pricing in error">
24+
<mat-step [stepControl]="step2.form" errorMessage="Pricing in error">
2525

26-
<create-course-step-2></create-course-step-2>
26+
<create-course-step-2 #step2></create-course-step-2>
2727

2828
<ng-template matStepLabel>course pricing details</ng-template>
2929

@@ -39,6 +39,23 @@ <h2 class="title">Create New Course</h2>
3939

4040
</mat-step>
4141

42+
<mat-step [stepControl]="step3.form" errorMessage="Course lessons in error">
43+
44+
<ng-template matStepLabel>course lessons</ng-template>
45+
46+
<create-course-step-3 #step3></create-course-step-3>
47+
48+
<div class="stepper-buttons">
49+
50+
<button mat-raised-button matStepperPrevious>Back</button>
51+
52+
<button mat-raised-button color="primary"
53+
[disabled]="!step3.form.valid">Create Course</button>
54+
55+
</div>
56+
57+
</mat-step>
58+
4259
</mat-horizontal-stepper>
4360

4461

0 commit comments

Comments
 (0)