我希望获得outer
text
时select box
selected
<ion-option value="1">Agriculture</ion-option> // output: Agriculture
例如: <ion-item>
<ion-label>Choose Industry Type</ion-label>
<ion-select [(ngModel)]="getSelectedValue" (ionChange)="getOuterName($event)">
<ion-option value="1">Agriculture</ion-option>
<ion-option value="2">Chemicals</ion-option>
<ion-option value="3">Pesticides</ion-option>
</ion-select>
</ion-item>
这是演示: https://stackblitz.com/edit/ionic-m7jy2n?file=pages%2Fhome%2Fhome.ts
下面是我的 html
getOuterName(event){
console.log(this.getSelectedValue);
alert(this.getSelectedValue);
console.log(event);
}
下面是我的控制器
static double Q2(ArrayList<Integer> input) {
Collections.sort(input);
ArrayList<Double> input2 = new ArrayList<>();
double sum = 0;
double sum2 = 0;
double sd = 0;
for (int i = 0; i < input.size(); i++) {
sum = sum + input.get(i);
}
double mean = sum / input.size();
for (int i = 0; i < input.size(); i++) {
input2.add((Math.pow((input.get(i) - mean), 2)));
}
for (int i = 0; i < input2.size(); i++) {
sum2 = sum2 + input2.get(i);
}
double mean2 = sum2 / input2.size();
sd = Math.sqrt(mean2);
return sd;
}
答案 0 :(得分:0)
只需删除值属性。
<ion-option>Agriculture</ion-option>
<ion-option>Chemicals</ion-option>
<ion-option>Pesticides</ion-option>
<强> DEMO 强>