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