I'm not able to get an object when I try to look for it through one of its attributes in an AngularFireList. What do you suggest?
Service
import { Injectable } from '@angular/core';
import { AngularFireDatabase, AngularFireList } from 'angularfire2/database';
import { Prestamo } from '../models/prestamo';
import { FirebaseDatabase } from 'angularfire2';
@Injectable({
providedIn: 'root'
})
export class PrestamoService {
prestamoLista: AngularFireList<any>;
prestamoSeleccionado: Prestamo = new Prestamo();
constructor(private firebase: AngularFireDatabase) {}
obtenerPrestamos()
{
return this.prestamoLista = this.firebase.list('prestamos');
}
obtenerPrestamo(codigo: string)
{
return this.prestamoLista = this.firebase.list('prestamos', ref => ref.orderByChild('codigo').equalTo(codigo));
}
}