I am trying to make a query in firebase with ionic and am having the following error:
Thefontlookslikethis:
import{Injectable}from'@angular/core';
importfirebasefrom'firebase'import{RequestModel}from'../model/order.model'
@Injectable()exportclassRequestService{
//DATA_URL=firebase.storage.StringFormat.DATA_URLpedidos:anypedidosPes:anyconstructor(){//InitializeFirebaseconstconfig={apiKey:"xx",
authDomain: "xx",
databaseURL: "xx",
projectId: "xx",
storageBucket: "xxx",
messagingSenderId: "xx"
};
firebase.initializeApp(config);
let ref = firebase.database().ref('statuspedido');//statuspedido
this.pedidos = new Array();
ref.on('value', (dataSnapshot) =>{
let items = dataSnapshot.val();
for(let dados in items){
this.pedidos.push(
new PedidoModel(
items[dados].dataEmissao,
items[dados].dataAtualizacao,
items[dados].vendedor,
items[dados].frete,
items[dados].transportadora,
items[dados].status)
)
}
})
}
loadDados(){
// console.log(this.pedidos);
return this.pedidos;
}
getItems(filtro: string){
this.pedidosPes = new Array();
let query = firebase.database().ref('statuspedido').orderByChild('status').startAt(filtro);
query.on('child_added', function(snap) {
let ped = snap.val();
this.pedidosPes.push(
new PedidoModel(
ped.dataEmissao,
ped.dataAtualizacao,
ped.vendedor,
ped.frete,
ped.transportadora,
ped.status)
)
console.log(ped.dataAtualizacao, ped.dataEmissao);
});
return this.pedidosPes;
}
}