SHARE
TWEET

Untitled

a guest Jan 14th, 2020 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, OnInit } from '@angular/core';
  2. import { Course } from '../model';
  3. import { CourseService } from '../course.service';
  4. import { FormControl, FormGroup } from '@angular/forms';
  5.  
  6. @Component({
  7.   selector: 'app-course-list',
  8.   templateUrl: './course-list.component.html',
  9.   styleUrls: ['./course-list.component.css'],
  10. })
  11. export class CourseListComponent implements OnInit {
  12.   courses: Course[];
  13.  
  14.   filters = new FormGroup({
  15.     name: new FormControl(''),
  16.     ects: new FormControl(''),
  17.     minRating: new FormControl(''),
  18.     maxRating: new FormControl(''),
  19.     semester: new FormControl('')
  20.   });
  21.  
  22.   constructor(private courseService: CourseService) {
  23.   }
  24.  
  25.   ngOnInit() {
  26.     this.fetchCourses();
  27.   }
  28.  
  29.   fetchCourses() {
  30.     this.courses = this.courseService.getAllCourses();
  31.   }
  32.  
  33.   onDeleted(deleted: Course) {
  34.     this.courseService.deleteCourse(deleted);
  35.     this.fetchCourses();
  36.   }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top