我正面临这个问题,请问有人可以帮助我解决此错误吗 类型“ AngularFireObject <{}>”不能分配给类型“ ObservableInput <{}>”。类型'AngularFireObject <{}>'中缺少属性'length',但类型'ArrayLike <{}>'中必需 在data.service.ts
import { Injectable } from '@angular/core';
import { AngularFireDatabase, AngularFireObject, AngularFireList}
from 'angularfire2/database';
import { User, database } from 'firebase/app';
import { Profile } from '../../models/profile/profile.interface';
import "rxjs/add/operator/take";
import "rxjs/add/operator/map";
import "rxjs/add/operator/mergeMap";
import firebase from 'firebase';
import { AuthService } from '../auth/auth.service';
import { USER_LIST } from '../../mocks/profile/profile';
constructor (private database: AngularFireDatabase) {
}
getAuthenticatedUserProfile() {
return this.auth.getAuthenticatedUser()
.map(user => user.uid)
.mergeMap(authId => this.database.object(`profiles/${authId}`)) <--error
.take(1);
}
`
在我的auth.service.ts中
constructor(private auth: AngularFireAuth) {
console.log('Hello AuthProvider Provider');
}
getAuthenticatedUser () {
return this.auth.authState;
}