import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { EventDetail } from '../../models/event-detail/event-detail.interface';
import { AngularFireDatabase, AngularFireList } from 'angularfire2/database';
@IonicPage()
@Component({
selector: 'page-event',
templateUrl: 'event.html',
})
export class EventPage {
eventDetail = {} as EventDetail;
eventDetailRef$: AngularFireList<EventDetail[]>;
constructor(public navCtrl: NavController, public navParams: NavParams, private database: AngularFireDatabase) {
this.eventDetailRef$ = this.database.list('event-detail');
}
addEvent( eventDetail: EventDetail) {
this.eventDetailRef$.push({
eventName: this.eventDetail.eventName,
eventDesc: this.eventDetail.eventDesc,
});
}
}
i came across a tutorial about Angular a year ago and recently read "Upgrading to Angularfire 5.0", but when I encountered an error and searched for solutions online, the results were quite varied.
The error message says:
"Argument of type '{ eventName: string; eventDesc: String; }' is not assignable to parameter of type 'EventDetail[]'. Object literal may only specify known properties, and 'eventName' does not exist in type 'EventDetail[]'."
This is how my EventDetail Interface looks like:
export interface EventDetail {
eventName: string;
eventDesc: String;
lat: number;
lgt: number;
}