Angular LMS app
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
Tento repozitář je archivovaný. Můžete prohlížet soubory, klonovat, ale nemůžete nahrávat a vytvářet nové úkoly a požadavky na natažení.
 
 
 
 

39 řádky
1.1 KiB

  1. import { Component, OnInit } from '@angular/core';
  2. import { DemoService } from '../../services/demo.service';
  3. import { Router } from '@angular/router';
  4. @Component({
  5. selector: 'app-courses',
  6. templateUrl: './courses.component.html',
  7. styleUrls: ['./courses.component.scss']
  8. })
  9. export class CoursesComponent implements OnInit {
  10. demoType: string;
  11. classCourseList = [];
  12. constructor(
  13. private demoService: DemoService,
  14. private router: Router
  15. ) { }
  16. ngOnInit(): void {
  17. this.demoType = localStorage.demoType;
  18. if (this.demoType === 'Student') {
  19. this.classCourseList = this.demoService.courseData;
  20. this.classCourseList = this.classCourseList.filter((courseClass) => {
  21. return courseClass.classLevel === '10';
  22. });
  23. } else {
  24. this.classCourseList = this.demoService.courseData;
  25. }
  26. }
  27. goToCourse(classLevel: string, courseId: string) {
  28. this.router.navigate(['/course-details', {
  29. classLevel: classLevel,
  30. courseId: courseId
  31. }])
  32. }
  33. }