Skip to content

Commit 0524534

Browse files
committed
Angular Forms Course
1 parent 29d05b3 commit 0524534

7 files changed

+43
-40
lines changed

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {MatRadioModule} from '@angular/material/radio';
3939
import {MatCheckboxModule} from '@angular/material/checkbox';
4040
import {CreateCourseStepOneComponent} from './create-course/create-course-step-one/create-course-step-one.component';
4141
import {CreateCourseStepTwoComponent} from './create-course/create-course-step-two/create-course-step-two.component';
42+
import {MatStepperModule} from '@angular/material/stepper';
4243

4344
@NgModule({
4445
declarations: [
@@ -79,6 +80,7 @@ import {CreateCourseStepTwoComponent} from './create-course/create-course-step-t
7980
MatNativeDateModule,
8081
MatRadioModule,
8182
MatCheckboxModule,
83+
MatStepperModule,
8284
FormsModule,
8385
ReactiveFormsModule
8486
],

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,6 @@
105105

106106
</mat-form-field>
107107

108-
<div class="form-buttons">
109-
110-
<button mat-raised-button (click)="reset()">
111-
Reset
112-
</button>
113-
114-
<button mat-raised-button color="primary" [disabled]="!form.valid" (click)="continueToStep2()">
115-
Continue to Step 2
116-
</button>
117-
118-
</div>
119-
120108
<div class="form-val">
121109

122110
{{form.errors | json}}

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,4 @@ export class CreateCourseStepOneComponent implements OnInit {
4141

4242
}
4343

44-
reset() {
45-
46-
this.form.reset();
47-
48-
}
49-
50-
continueToStep2() {
51-
console.log("Step 1 form values", this.form.value);
52-
}
53-
5444
}

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

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11

22
<div class="create-course-panel data-form">
33

4-
<h2 class="title">Create New Course <span class="current-step"> step {{currentStep}} of 3</span></h2>
4+
<h2 class="title">Create New Course</h2>
55

66

7+
<mat-horizontal-stepper labelPosition="bottom" class="mat-elevation-z5">
78

9+
<mat-step [stepControl]="stepOne.form">
810

9-
<create-course-step-one></create-course-step-one>
11+
<ng-template matStepLabel>course landing page details</ng-template>
12+
13+
<create-course-step-one #stepOne></create-course-step-one>
14+
15+
<div>
16+
<button mat-raised-button color="primary" matStepperNext>Continue to Step 2</button>
17+
</div>
18+
19+
</mat-step>
20+
21+
<mat-step>
22+
23+
<ng-template matStepLabel>course pricing details</ng-template>
24+
25+
<div>
26+
<button mat-raised-button matStepperPrevious>Back</button>
27+
<button mat-raised-button color="primary" matStepperNext>Continue to Step 3</button>
28+
</div>
29+
30+
</mat-step>
31+
32+
</mat-horizontal-stepper>
1033

1134
</div>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
h2 {
3+
font-family: "Roboto";
4+
}
5+
6+
.data-form {
7+
max-width: 600px;
8+
margin: 0 auto;
9+
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
import { Component, OnInit } from '@angular/core';
22

33

4+
5+
46
@Component({
57
selector: 'create-course',
68
templateUrl: './create-course.component.html',
7-
styleUrls: ['./create-course.component.css']
9+
styleUrls: ['./create-course.component.scss']
810
})
911
export class CreateCourseComponent implements OnInit {
1012

1113

14+
constructor() {
1215

13-
currentStep = 1;
14-
16+
}
1517

1618

1719
ngOnInit() {
1820

21+
22+
1923
}
2024

2125

0 commit comments

Comments
 (0)