maybe problem has been resolved, but I can’t get data with {{p.provinceid}}
and{{p.name}}.
…this is my data, It’s saved localStorage:
{success: true,…}
data{
district
[{districtid: "001", provinceid: "01", name: "Ba Đình"},…]
province
[{provinceid: "01", name: "Hà Nội"}, {provinceid: "02", name: "Hà Giang"},…]
{provinceid: "01", name: "Hà Nội"}
{provinceid: "02", name: "Hà Giang"}
{provinceid: "04", name: "Cao Bằng"}
{provinceid: "06", name: "Bắc Kạn"}
{provinceid: "08", name: "Tuyên Quang"}
{provinceid: "10", name: " Lào Cai"}
{provinceid: "11", name: " Điện Biên"}
{provinceid: "12", name: "Lai Châu"}
{provinceid: "14", name: "Sơn La"}
{provinceid: "15", name: "Yên Bái"}
{provinceid: "17", name: "Hòa Bình"}
}
success true
this is TS file
province = window.localStorage.getItem('city');
ionViewDidLoad() {
this.loadingprovider.showLoader(this);
let province = JSON.parse(this.province);
let dataPro = province.data.province;
console.log(dataPro);
this.profileService.load().subscribe(data => {
if(data.success==true){
this.profile = data.data;
console.log(data);
this.loading.dismiss();
}
},(err)=>{
this.loading.dismiss();
})
}
let province = JSON.parse(this.province);
let dataPro = province.data.province;
console.log(dataPro);
HTML file
<ion-item>
<ion-label stacked>{{'City' | translate}}</ion-label>
<ion-select [(ngModel)]="dataProvince" name="province">
<ion-option *ngFor="let p of dataPro" value="{{p.provinceid}}">{{p.name}}</ion-option>
</ion-select>
</ion-item>
I can show data with console.log with province array, but I can’t get data from province array, can you help me??
Thanks for the suggestion above <3