Creating a form where users can input various information, including their country code selected from dropdowns. Upon submission, the data is displayed successfully when running in a browser. However, after building the apk file, the country codes fail to load. The JSON file containing the countries' codes is stored in assets and accessed through providers. I am invoking the service in IonViewDidLoad as follows:
ionViewDidLoad(){
this.service.getData()
.subscribe(
(success: Country) => {
this.country = success;
console.log(success);
},
err => {
this.toast.create({
message: JSON.parse(err)
}).present()
}
)
}
Below is my service class:
private url = "../../assets/imgs/country.json";
constructor(public http: HttpClient) {
console.log('Hello AppointmentProvider Provider');
}
public getData(){
return this.http.get<any>(this.url);
}
I have also attempted calling the service from IonViewDidEnter and the constructor without achieving success. Any assistance would be greatly appreciated, as I am relatively new to Ionic and Angular technologies.
Thank you for your help!