Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit } from '@angular/core';
- import { Course } from '../model';
- import { CourseService } from '../course.service';
- import { FormControl, FormGroup } from '@angular/forms';
- @Component({
- selector: 'app-course-list',
- templateUrl: './course-list.component.html',
- styleUrls: ['./course-list.component.css'],
- })
- export class CourseListComponent implements OnInit {
- courses: Course[];
- filters = new FormGroup({
- name: new FormControl(''),
- ects: new FormControl(''),
- minRating: new FormControl(''),
- maxRating: new FormControl(''),
- semester: new FormControl('')
- });
- constructor(private courseService: CourseService) {
- }
- ngOnInit() {
- this.fetchCourses();
- }
- fetchCourses() {
- this.courses = this.courseService.getAllCourses();
- }
- onDeleted(deleted: Course) {
- this.courseService.deleteCourse(deleted);
- this.fetchCourses();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement