Skip to content

Commit

Permalink
Angular Forms In Depth
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jan 29, 2021
1 parent a8bb148 commit 7b60130
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@

</div>

<div class="form-val">
<!--div class="form-val">
{{form.value | json}}
</div>
</div-->



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class CreateCourseStep1Component implements OnInit {
releasedAt: [new Date(), Validators.required],
category: ['BEGINNER', Validators.required],
downloadsAllowed: [false, Validators.requiredTrue],
longDescription: ['', [Validators.required, Validators.minLength(3)]],
address: [null, Validators.required]
longDescription: ['', [Validators.required, Validators.minLength(3)]]
//address: [null, Validators.required]
});

courseCategories$ : Observable<CourseCategory[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

</div>

<div class="form-val">
<!--div class="form-val">
Form validity state: {{form.valid }}
Expand All @@ -51,4 +51,4 @@
{{form.value | json}}
</div>
</div-->
7 changes: 5 additions & 2 deletions src/app/create-course/create-course.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

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

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

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

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

</div>

Expand Down
8 changes: 4 additions & 4 deletions src/app/create-course/create-course.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import {STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';
export class CreateCourseComponent implements OnInit {




ngOnInit() {



}


submit(step1, step2, step3) {

console.log(step1, step2, step3);

}

}

0 comments on commit 7b60130

Please sign in to comment.