import {Injectable} from '@angular/core'; import {AngularFireDatabase, AngularFireList} from '@angular/fire/database'; import ArticleFire from '../../models/imageDetails'; @Injectable({ providedIn: 'root' }) export class ImageService { imageRef: AngularFireList; private dbPath = '/images'; constructor(private db: AngularFireDatabase) { this.imageRef = db.list(this.dbPath); } getAll(): AngularFireList { return this.imageRef; } create(article: ArticleFire): any { return this.imageRef.push(article); } update(key: string, value: any): Promise { return this.imageRef.update(key, value); } delete(key: string): Promise { return this.imageRef.remove(key); } deleteAll(): Promise { return this.imageRef.remove(); } }