Posts

Showing posts with the label question2answer

Angular ( service provider)

Image
Clash Royale CLAN TAG #URR8PPP Angular ( service provider) please i need your help . i'm developping an hybrid app with ionic, angular, cordova and i created a service with the name piecesservice import {Injectable} from "@angular/core"; import {HttpClient} from "@angular/common/http"; import {Observable} from "rxjs"; @Injectable() export class PiecesService { private donnes: any; constructor(public http: HttpClient) { } getCote(nomCote, nomRobot) { this.http.get('./assets/etat_pieces.json').subscribe( data => { this.donnes = data; console.log(this.donnes); for (var i = 0; i < this.donnes.cote.length; i++) { if (this.donnes.cote[i].nom = nomCote) { for (var j = 0; j < this.donnes.cote[i].robots.length; j++) if (this.donnes.cote[i].robots[j].nom = nomRobot) { console.log(this.donnes.cote[i].robots[j].pieces); return this.donnes.cote[i].robots[j].pieces; } ...