1
1
import {
2
+ AfterContentChecked , AfterContentInit , AfterViewChecked , AfterViewInit ,
2
3
Attribute ,
3
4
ChangeDetectionStrategy ,
4
5
ChangeDetectorRef ,
5
- Component ,
6
+ Component , DoCheck ,
6
7
EventEmitter ,
7
8
Input , OnChanges ,
8
9
OnDestroy ,
@@ -16,10 +17,12 @@ import {CoursesService} from '../services/courses.service';
16
17
@Component ( {
17
18
selector : 'course-card' ,
18
19
templateUrl : './course-card.component.html' ,
19
- styleUrls : [ './course-card.component.css' ] ,
20
- changeDetection : ChangeDetectionStrategy . OnPush
20
+ styleUrls : [ './course-card.component.css' ]
21
21
} )
22
- export class CourseCardComponent implements OnInit , OnDestroy , OnChanges {
22
+ export class CourseCardComponent implements
23
+ OnInit , OnDestroy , OnChanges ,
24
+ AfterContentChecked , AfterViewChecked ,
25
+ AfterContentInit , AfterViewInit , DoCheck {
23
26
24
27
@Input ( )
25
28
course : Course ;
@@ -31,6 +34,8 @@ export class CourseCardComponent implements OnInit, OnDestroy, OnChanges {
31
34
courseEmitter = new EventEmitter < Course > ( ) ;
32
35
33
36
37
+
38
+
34
39
constructor ( private coursesService : CoursesService ,
35
40
@Attribute ( 'type' ) private type : string ) {
36
41
@@ -41,36 +46,59 @@ export class CourseCardComponent implements OnInit, OnDestroy, OnChanges {
41
46
42
47
ngOnChanges ( changes ) {
43
48
44
- console . log ( " ngOnChanges" , changes ) ;
49
+ console . log ( ' ngOnChanges' , changes ) ;
45
50
}
46
51
47
52
ngOnInit ( ) {
48
53
49
- console . log ( "ngOnInit" , this . course ) ;
54
+ console . log ( 'ngOnInit' ) ;
55
+
56
+
57
+ }
58
+
59
+ ngDoCheck ( ) {
60
+ console . log ( "ngDoCheck" ) ;
61
+ }
50
62
63
+ ngAfterContentInit ( ) {
64
+ console . log ( "ngAfterContentInit" ) ;
65
+ }
66
+
67
+ ngAfterViewInit ( ) {
68
+ console . log ( "ngAfterViewInit" ) ;
69
+ }
70
+
71
+
72
+ ngAfterContentChecked ( ) {
73
+
74
+ console . log ( 'ngAfterContentChecked' ) ;
75
+
76
+ }
77
+
78
+ ngAfterViewChecked ( ) {
79
+
80
+ console . log ( 'ngAfterViewChecked' ) ;
51
81
52
82
}
53
83
54
84
ngOnDestroy ( ) {
55
85
56
- console . log ( " ngOnDestroy" ) ;
86
+ console . log ( ' ngOnDestroy' ) ;
57
87
58
88
}
59
89
60
- onTitleChanged ( newTitle :string ) {
90
+ onTitleChanged ( newTitle : string ) {
61
91
62
92
this . course . description = newTitle ;
63
93
64
94
}
65
95
66
96
67
- onSaveClicked ( description :string ) {
97
+ onSaveClicked ( description : string ) {
68
98
69
99
this . courseEmitter . emit ( { ...this . course , description} ) ;
70
100
71
101
}
72
102
73
103
74
-
75
-
76
104
}
0 commit comments