我试图从firebase中检索数据但是我在输出中得到的响应是response.json()不是函数..请帮助我..
src \ provider \ userservice.ts文件
import { Injectable } from '@angular/core';
import { User } from '../../models/userdata'
import { Http } from '@angular/http';
import { AuthService } from '../../providers/user/auth';
import { Response } from '@angular/http/src/static_response';
import 'rxjs/add/operator/map';
//import { AngularFireDatabase, FirebaseListObservable } from
'angularfire2/database';
@Injectable()
export class UserServiceProvider {
user: User[];
constructor(private authservice: AuthService, private http: HttpClient)
{
console.log('Hello UserProvider Provider');
}
fetchList(token: string) {
const userId = this.authservice.ActiveUser().uid;
console.log('uid'+ userId);
return this.http.get('https://recipe-book-ef34f.firebaseio.com/' +
userId +
'/shopping-list.json?auth=' + token)
.map((response: Response) => {
return response.json(); } )
.do((user: User[]) => {
if(user) {
this.user = user;
}
});
}