I have the following code:
<ion-list>
<ion-item>
<ion-select placeholder="País..." [formControl]="authForm.controls['country_code']">
<ion-option *ngFor="let countries of country">
{{countries.country_name}} ({{countries.dialling_code}})
</ion-option>
</ion-select>
</ion-item>
</ion-list>
Where country
is a JSON like this:
country = [
{ "country_code": "AL", "country_name": "Albania", "dialling_code": "+355" },
{ "country_code": "DZ", "country_name": "Algeria", "dialling_code": "+213" }];
And what I want is to get country_code
property but all I get is the next object:
{firstname: "asdas", lastname: "asdas", country_code: "↵ Albania (+355)↵ ", gender: "m"}