Skip to content
Snippets Groups Projects
term-container.component.ts 812 B
Newer Older
import { Component, Input } from '@angular/core';
import { Term } from '../../core/models/term';
import { Course } from '../../core/models/course';
import { DataService } from '../../core/data.service';
	selector: 'app-term-container',
	templateUrl: './term-container.component.html',
	styleUrls: ['./term-container.component.scss']
export class TermContainerComponent {
	@Input() term: Term;
	terms: any[];
	courses: Course[];
	constructor(private dataService: DataService) {
		this.dataService.getDegreePlannerCourseData()
		.subscribe(degreePlanCourses => {
			this.terms = degreePlanCourses;
		});
	}
	getCoursesByTerm( termCode ) {
		if (this.terms) {
			for ( const term of this.terms ) {
				if (term.termCode === termCode) {
					return term.courses;
				}
			}
		}
		return [];
	}