1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
public puiss:number = 7;
public phase:string = "TRIPHASÉ";
// Dans mon constructeur j'ai :
getData(puiss, phase) {
this.machineService.getMachines(puiss, phase)
.subscribe(result => {
this.items = result;
})
}
// Dans mon ngInit j'ai :
ngOnInit() {
this.getData(this.puiss, this.phase);
}
// dans mon services j'ai :
getMachines(puiss, phase) {
return this.db.collection('machines', ref => ref.where('phase', '==', phase)
.where('puissance', '<=', puiss))
.snapshotChanges()
}
// Rien ne s'affiche, mais si je fais dans mon service :
getMachines(puiss, phase) {
return this.db.collection('machines', ref => ref.where('phase', '==', phase))
.snapshotChanges()
}
// OU
getMachines(puiss, phase) {
return this.db.collection('machines', ref => ref.where('puissance', '<=', puiss))
.snapshotChanges()
}
//ça marche,
//mais impossible de combiner les 2 requêtes souhaitées |
Partager