У меня успешное обновление angularfire 5.0.0.rc 8 и firebase 5.0.2 без модуля ошибок.Я думаю, последнее, что мне нужно сделать, это изменить этот код, чтобы получить все данные
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { IonicPage } from 'ionic-angular/navigation/ionic-page';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/map';
import { Note } from '../../model/note/note.model';
import { NoteListService } from '../../services/note-list.service';
@IonicPage()
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
noteList: Observable<Note[]>
constructor(public navCtrl: NavController, private noteListService: NoteListService) {
this.noteList = this.noteListService.getNoteList()
.snapshotChanges()
.map(
changes => {
return changes.map(c => ({
key: c.payload.key, ...c.payload.val()
}))
});
}
}
файл для noteListService ...
import { Injectable } from '@angular/core';
import { AngularFireDatabase } from 'angularfire2/database';
import { Note } from '../model/note/note.model';
@Injectable()
export class NoteListService {
private noteListRef = this.db.list<Note>('note-list');
constructor(private db: AngularFireDatabase) { }
getNoteList() {
return this.noteListRef;
}
addNote(note: Note) {
return this.noteListRef.push(note);
}
updateNote(note: Note) {
return this.noteListRef.update(note.key, note);
}
removeNote(note: Note) {
return this.noteListRef.remove(note.key);
}
}
Помощь по изменению этого кода, который будет совместим смоя новая версия angularfire 5.0.0 rc 8 и firebase 5.0.2
это новая ошибка после того, как половина моего кода работает .. Вставьте часть.Но все же я не могу запросить
Runtime Error
Uncaught (in promise): TypeError: this.noteListService.getNoteList(...).snapshotChanges(...).map is not
функцию TypeError: this.noteListService.getNoteList (...). SnapshotChanges (...). Map не является функцией на новой HomePage(http://localhost:8100/build/0.js:86:14) в createClass (http://localhost:8100/build/vendor.js:10575:20) в createDirectiveInstance (http://localhost:8100/build/vendor.js:10458:20) в createViewNodes (http://localhost:8100/build/vendor.js:11680:36) в createRootView (http://localhost:8100/build/vendor.js:11594:5) в callWithDebugContext (*)1024 * в Object.debugCreateRootView [as createRootView] (http://localhost:8100/build/vendor.js:12116:12) в ComponentFactory_.create (http://localhost:8100/build/vendor.js:9938:29) в ComponentFactoryBoundToModule.create (http://localhost:8100/build/vendor.js:3914:29) в NavControllerBase._viewInit (* 1032)Ошибка стека: Uncaught (в обещании): Ошибка типа: this.noteListService.getNoteList (...). SnapshotChanges (...). Map не является функцией