Skip to content

Commit 7b60130

Browse files
author
Your Name
committed
Angular Forms In Depth
1 parent a8bb148 commit 7b60130

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555

5656
</div>
5757

58-
<div class="form-val">
58+
<!--div class="form-val">
5959
6060
{{form.value | json}}
6161
62-
</div>
62+
</div-->
6363

6464

6565

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export class CreateCourseStep1Component implements OnInit {
3030
releasedAt: [new Date(), Validators.required],
3131
category: ['BEGINNER', Validators.required],
3232
downloadsAllowed: [false, Validators.requiredTrue],
33-
longDescription: ['', [Validators.required, Validators.minLength(3)]],
34-
address: [null, Validators.required]
33+
longDescription: ['', [Validators.required, Validators.minLength(3)]]
34+
//address: [null, Validators.required]
3535
});
3636

3737
courseCategories$ : Observable<CourseCategory[]>;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
</div>
4343

44-
<div class="form-val">
44+
<!--div class="form-val">
4545
4646
Form validity state: {{form.valid }}
4747
@@ -51,4 +51,4 @@
5151
5252
{{form.value | json}}
5353
54-
</div>
54+
</div-->

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<h2 class="title">Create New Course</h2>
55

6-
<mat-horizontal-stepper [linear]="false"
6+
<mat-horizontal-stepper [linear]="true"
77
class="mat-elevation-z5" labelPosition="bottom">
88

99
<mat-step [stepControl]="step1.form" errorMessage="Landing page in error">
@@ -50,7 +50,10 @@ <h2 class="title">Create New Course</h2>
5050
<button mat-raised-button matStepperPrevious>Back</button>
5151

5252
<button mat-raised-button color="primary"
53-
[disabled]="!step3.form.valid">Create Course</button>
53+
[disabled]="!step3.form.valid || step3.lessons.length == 0"
54+
(click)="submit(step1.form.value, step2.form.value, step3.form.value)">
55+
Create Course
56+
</button>
5457

5558
</div>
5659

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ import {STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';
1717
export class CreateCourseComponent implements OnInit {
1818

1919

20-
21-
2220
ngOnInit() {
2321

24-
25-
2622
}
2723

2824

25+
submit(step1, step2, step3) {
26+
27+
console.log(step1, step2, step3);
2928

29+
}
3030

3131
}

0 commit comments

Comments
 (0)