I was following a "tutorial" where I can read an API from Angular. When I open my Symfony, I can read the endpoint with a GET and a POST (with Postman too).
ngOnInit() {
try {
return this.infosService.getAllInfos()
.subscribe(data => this.infos = data);
} catch(e) {
console.log("TEST KO");
}
}
In my infos.service.ts file, I got these lines to get the datas but only call getAllInfos in this example:
apiUrl='Http://localhost:8000/api/info';
constructor(private _http: HttpClient) { }
getInfos() {
return this._http.get<Infos[]>(this.apiUrl);
}
getAllInfos() {
return this._http.get<Infos[]>(this.apiUrl);
}
Where did I mess up?