@@ -17,7 +17,8 @@ export class CoursesComponent implements AfterViewInit {
1717
1818 public dataIsAvailable : boolean = false ;
1919 public courses : Array < any > ;
20- public headerText : string ;
20+ public headerText : string = "" ;
21+ public category : string = "" ;
2122
2223 constructor (
2324 public categoryService : CategoryService ,
@@ -28,8 +29,9 @@ export class CoursesComponent implements AfterViewInit {
2829 public renderer : Renderer2 ) { }
2930
3031 ngAfterViewInit ( ) {
31- this . comService . getColor ( ) . subscribe ( color => {
32- this . renderer . addClass ( this . backgroundElement . nativeElement , color ) ;
32+ this . comService . getInfo ( ) . subscribe ( response => {
33+ this . category = response . category ;
34+ this . renderer . addClass ( this . backgroundElement . nativeElement , response . color ) ;
3335 } ) ;
3436
3537 this . activatedRoute . params . subscribe ( ( params : Params ) => {
@@ -43,11 +45,11 @@ export class CoursesComponent implements AfterViewInit {
4345 }
4446
4547 requestCoursesByUser ( ) :void {
48+ this . headerText = "Meine" ;
4649 this . userService . getCoursesByUser ( ) . subscribe ( response => {
4750 response . forEach ( element => {
4851 this . courses = [ ] ;
4952 this . coursesService . getCoursesByCourseId ( element . ANM_KURS_ID ) . subscribe ( response => {
50- console . log ( response ) ;
5153 response . ANM_DATUM = element . ANM_DATUM ;
5254 this . courses . push ( response ) ;
5355 } ) ;
@@ -59,6 +61,7 @@ export class CoursesComponent implements AfterViewInit {
5961 }
6062
6163 requestCoursesByCategory ( courseId : string ) :void {
64+ this . headerText = this . category ;
6265 this . categoryService . getCoursesByCategoryId ( courseId ) . subscribe ( response => {
6366 this . courses = response ;
6467 if ( response . name != "HttpResponseError" ) {
0 commit comments