Currently, I am facing an issue with fetching data from a simple API. Strangely, the functionality works perfectly fine when testing in ionic serve (browser). However, upon building the app, the HTTP call fails to work. Below is the snippet of my code:
this.http.get("http://example.com/api/routes").subscribe(response => {
this.routes = response["routes"];
for (let x in this.routes) {
let a = this.routes[x].rou_stops;
let b = a.split(",");
for (let y in b) {
this.newCit.push(b[y]);
}
}
});
If anyone has encountered a similar problem before or knows how to resolve this issue, your assistance would be greatly appreciated. Thank you.