Answers for "'push' does not exist on type 'Observable<any>'"

0

'push' does not exist on type 'Observable<any>'

import {Component} from '@angular/core';
import { AngularFireDatabase } from 'angularfire2/database';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    courses$;
    courseObservable;
    authors$;
    constructor(db: AngularFireDatabase) {
        this.courseObservable = db.list('/courses');
        this.courses$ = this.courseObservable.valueChanges();
        this.authors$ = db.object('/authors/1').valueChanges();

    }
    add(course: HTMLInputElement) {
        this.courseObservable.push(course.value);
        course.value = '';
    }
}
Posted by: Guest on November-01-2020

Code answers related to "'push' does not exist on type 'Observable<any>'"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language