我正在尝试从离子选择组件中获取值,而未获取值。当我按Submit时,submitForm会被调用,然后我会console.log记录为空白的AssignedCountry参数。我希望能用一个国家名代替。
打字稿:
submitForm(
assignedCountry,
..more parameters
) {
let countries = countriesJSON; // a bunch of country names ['USA', 'China' ]
console.log(assignedCountry); // getting a blank
}
HTML:
<form
[formGroup]="employeeForm"
(ngSubmit)="
submitForm(
assignedCountry.value,
)
"
>
<ion-select placeholder="Select One" #assignedCountry>
<ion-select-option
*ngFor="let country of countries" value="country"
>{{ country.countryName }}</ion-select-option
</ion-select>
<ion-button type="submit">Submit</ion-button>
</form>