add shows
This commit is contained in:
parent
6d6a817a47
commit
5f7968a756
@ -3,6 +3,7 @@ import {ShowService} from '../../services/show.service';
|
|||||||
import {Show} from '../../model/show';
|
import {Show} from '../../model/show';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
|
import {addDoc, collection, Firestore} from '@angular/fire/firestore';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-show-form',
|
selector: 'app-show-form',
|
||||||
@ -14,13 +15,12 @@ import {Observable} from 'rxjs';
|
|||||||
styleUrl: './show-form.component.css'
|
styleUrl: './show-form.component.css'
|
||||||
})
|
})
|
||||||
export class ShowFormComponent {
|
export class ShowFormComponent {
|
||||||
showService: ShowService = inject(ShowService);
|
fireStore: Firestore = inject(Firestore);
|
||||||
|
private seriesCollection = 'table_show';
|
||||||
show: Show = new Show(0, "");
|
show: Show = new Show(0, "");
|
||||||
shows: Observable<Show[]> = this.showService.getShows();
|
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
// this.shows.push(this.show);
|
const showsRef = collection(this.fireStore, this.seriesCollection);
|
||||||
|
addDoc(showsRef, {id: this.show.uid, title: this.show.title,});
|
||||||
this.show = new Show(0, "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user