Property 'push' does not exist on type 'Observable<any[]>' code example
Example: 'push' does not exist on type 'Observable'
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 = '';
}
}