我正在尝试编写一个查询,该查询将根据其键从集合中提取单个项目。
我一直在搜索和关注很多教程,但一切似乎都只是展示了如何获得如下列表:
我想传入 $key 并查询并提取一条记录。任何可以提供帮助的来源的建议或指导将不胜感激。
import { Injectable } from '@angular/core';
import { Customer } from "./customer";
import { AngularFire, FirebaseListObservable} from 'angularfire2';
@Injectable()
export class CustomerService {
customer: Customer;
customers: FirebaseListObservable<Customer[]>;
categories: FirebaseListObservable<Category[]>;
constructor(private af: AngularFire) { }
getCustomer(customerIndex: number) {
this.customers = this.af.database.list('customer');
return this.customers;
}
}