|
- import { Component, OnInit } from '@angular/core';
- import { DemoService } from '../../services/demo.service';
- import { Router } from '@angular/router';
-
- @Component({
- selector: 'app-courses',
- templateUrl: './courses.component.html',
- styleUrls: ['./courses.component.scss']
- })
- export class CoursesComponent implements OnInit {
- demoType: string;
- classCourseList = [];
-
- constructor(
- private demoService: DemoService,
- private router: Router
- ) { }
-
- ngOnInit(): void {
- this.demoType = localStorage.demoType;
- if (this.demoType === 'Student') {
- this.classCourseList = this.demoService.courseData;
- this.classCourseList = this.classCourseList.filter((courseClass) => {
- return courseClass.classLevel === '10';
- });
- } else {
- this.classCourseList = this.demoService.courseData;
- }
- }
-
- goToCourse(classLevel: string, courseId: string) {
- this.router.navigate(['/course-details', {
- classLevel: classLevel,
- courseId: courseId
- }])
- }
-
- }
|