Skip to content

Instantly share code, notes, and snippets.

@bariscanyilmaz
Last active April 24, 2019 18:31
Show Gist options
  • Save bariscanyilmaz/ee86718356868359d7c248662006a8b9 to your computer and use it in GitHub Desktop.
Save bariscanyilmaz/ee86718356868359d7c248662006a8b9 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Category } from '../models/category.model';
@Injectable({
providedIn: 'root'
})
export class CategoryService {
constructor(private fireStore: AngularFirestore) {
}
getCategories(){
return this.fireStore.collection('Categories').snapshotChanges();
}
addCategory(category:Category){
return this.fireStore.collection('Categories').add({...category});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment