first commit
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, FormArray, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { EventService } from 'src/app/service/event.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-event',
|
||||
@ -6,13 +9,21 @@ import { Component, OnInit } from '@angular/core';
|
||||
styleUrls: ['./event.component.css']
|
||||
})
|
||||
export class EventComponent implements OnInit {
|
||||
events: any[] = []; // Define the type according to your model
|
||||
|
||||
constructor() { }
|
||||
|
||||
htmlContent: string = '';
|
||||
|
||||
constructor(private eventService: EventService, private router: Router) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadEvents();
|
||||
}
|
||||
|
||||
}
|
||||
loadEvents(): void {
|
||||
this.eventService.getEvents().subscribe(events => this.events = events);
|
||||
}
|
||||
|
||||
deleteEvent(id: number): void {
|
||||
if (confirm('Are you sure you want to delete this event?')) {
|
||||
// this.eventService.deleteEvent(id).subscribe(() => this.loadEvents());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user