Salut. Merci. Je poursuis juste une formation en autoformation et j’utilise cette archetcture pour apprende autres fonctionnalités d’Angular. Merci bcp.
Le ven. 11 jan. 2019 à 23:15, Tito <yosi...@gmail.com> a écrit : > ce que veux te dire c'est que si demain tu voudrais utilizer le data dans > ce json d'un autre site, cette architecture est trop frgile :) > > On Friday, January 11, 2019 at 10:37:42 AM UTC-8, Bakadiri Abdelouahab > wrote: >> >> So I must put my file in a asset folder. It’s work now thank you so much. >> >> Le ven. 11 jan. 2019 à 02:38, Tito <yos...@gmail.com> a écrit : >> >>> I saw this on SO >>> >>> import { HttpClient } from '@angular/common/http'; import { Observable } >>> from 'rxjs/Observable'; >>> >>> constructor(private http: HttpClient) { >>> this.getJSON().subscribe(data => { >>> console.log(data) >>> }); >>> } >>> >>> public getJSON(): Observable<any> { >>> return this.http.get("./assets/mydata.json") >>> } >>> >>> >>> On Thursday, January 10, 2019 at 10:50:14 AM UTC-8, Bakadiri Abdelouahab >>> wrote: >>>> >>>> Hello; >>>> I have a local JSON file that conient a list of products, I want to >>>> access to it using a HTTP service through a get function, my class service >>>> and the json file are in the same folder, when i put: >>>> getProducts(): Observable<Iproduct[]> { >>>> return this._http.get<Iproduct[]>('./products.json'); >>>> } >>>> I have a error like this: >>>> GET http://localhost:4200/products.json 404 (Not Found) >>>> Do you have any idea about where angular put this file while it build >>>> my application. >>>> thank you. >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Angular and AngularJS discussion" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to angular+u...@googlegroups.com. >>> To post to this group, send email to ang...@googlegroups.com. >> >> >>> Visit this group at https://groups.google.com/group/angular. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> Envoyer depuis mon Iphone >> > -- > You received this message because you are subscribed to the Google Groups > "Angular and AngularJS discussion" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to angular+unsubscr...@googlegroups.com. > To post to this group, send email to angular@googlegroups.com. > Visit this group at https://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- Envoyer depuis mon Iphone -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.