Angular LMS app
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Repozitorijs ir arhivēts. Tam var aplūkot failus un to var klonēt, bet nevar iesūtīt jaunas izmaiņas, kā arī atvērt jaunas problēmas/izmaiņu pieprasījumus.

courses.component.ts 1.1 KiB

1234567891011121314151617181920212223242526272829303132333435363738
  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. }