Skip to content

Commit f47d63b

Browse files
author
Your Name
committed
Angular Material In Depth
1 parent 6b97437 commit f47d63b

File tree

2 files changed

+58
-30
lines changed

2 files changed

+58
-30
lines changed

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

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,71 @@
11

22

3+
<div class="edit-course-form">
34

5+
<h2 mat-dialog-title>{{description}}</h2>
46

7+
<mat-dialog-content [formGroup]="form">
58

9+
<mat-form-field>
610

7-
<!--
11+
<input matInput
12+
placeholder="Course Description"
13+
formControlName="description">
814

9-
<mat-form-field>
15+
</mat-form-field>
1016

11-
<input matInput
12-
placeholder="Course Description"
13-
formControlName="description">
17+
<mat-form-field>
1418

15-
</mat-form-field>
19+
<mat-select placeholder="Select category"
20+
formControlName="category">
1621

17-
<mat-form-field>
22+
<mat-option value="BEGINNER">
23+
Beginner</mat-option>
24+
<mat-option value="INTERMEDIATE">
25+
Intermediate</mat-option>
26+
<mat-option value="ADVANCED">
27+
Advanced</mat-option>
1828

19-
<mat-select placeholder="Select category"
20-
formControlName="category">
29+
</mat-select>
2130

22-
<mat-option value="BEGINNER">
23-
Beginner</mat-option>
24-
<mat-option value="INTERMEDIATE">
25-
Intermediate</mat-option>
26-
<mat-option value="ADVANCED">
27-
Advanced</mat-option>
31+
</mat-form-field>
2832

29-
</mat-select>
33+
<mat-form-field>
3034

31-
</mat-form-field>
35+
<input matInput [matDatepicker]="myDatepicker"
36+
formControlName="releasedAt">
3237

33-
<mat-form-field>
38+
<mat-datepicker-toggle matSuffix
39+
[for]="myDatepicker">
3440

35-
<input matInput [matDatepicker]="myDatepicker"
36-
formControlName="releasedAt">
41+
</mat-datepicker-toggle>
3742

38-
<mat-datepicker-toggle matSuffix
39-
[for]="myDatepicker">
43+
<mat-datepicker #myDatepicker></mat-datepicker>
4044

41-
</mat-datepicker-toggle>
45+
</mat-form-field>
4246

43-
<mat-datepicker #myDatepicker></mat-datepicker>
44-
45-
</mat-form-field>
46-
47-
<mat-form-field>
47+
<mat-form-field>
4848

4949
<textarea matInput placeholder="Description"
5050
formControlName="longDescription">
5151

5252
</textarea>
5353

54-
</mat-form-field>
54+
</mat-form-field>
55+
56+
</mat-dialog-content>
57+
58+
<mat-dialog-actions>
59+
60+
<button mat-raised-button (click)="close()">Close</button>
61+
62+
<button mat-raised-button color="primary" (click)="save()">Save</button>
63+
64+
</mat-dialog-actions>
65+
66+
</div>
67+
5568

5669

5770

5871

59-
-->

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ import * as moment from 'moment';
1111
})
1212
export class CourseDialogComponent implements OnInit {
1313

14+
description:string;
15+
16+
form = this.fb.group({
17+
description: ['', Validators.required],
18+
category: ["BEGINNER", Validators.required],
19+
releasedAt: [new Date(), Validators.required],
20+
longDescription: ["", Validators.required]
21+
});
22+
1423
constructor(private fb: FormBuilder) {
1524

1625

@@ -20,5 +29,12 @@ export class CourseDialogComponent implements OnInit {
2029

2130
}
2231

32+
close() {
33+
34+
}
35+
36+
save() {
37+
38+
}
2339
}
2440

0 commit comments

Comments
 (0)