我正在尝试从 ion-select 中获取所选选项 Value
但是当我从 ion-select 中选择任何值时,我得到了Undefined值,因为我是 ionic 的新手,
我无法自己对其进行排序。
HTML:
<ion-item>
<ion-label>Quantity</ion-label>
<ion-select [(ngModel)]="number"
(ionChange)="onChange(carbrand)" >
<ion-option *ngFor="let count of quantity"
[value]="count" >{{count}}</ion-option>
</ion-select>
<!-- <ion-select [(ngModel)]="number">
<ion-option *ngFor="let count of quantity"
value="count"></ion-option>
</ion-select> -->
</ion-item>
Run Code Online (Sandbox Code Playgroud)
主页.ts :
onChange(SelectedValue){
console.log("Selected Quantity", SelectedValue);
}
Run Code Online (Sandbox Code Playgroud) 我刚刚安装了 Android Studio 并在其中创建了一个项目,但是每当我在其中添加 TextView 时,它都没有显示任何内容,即使TextViewAndroid Studio 已经创建的Activity.xml代码也没有显示
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".MainActivity"
tools:layout_editor_absoluteY="25dp">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
tools:layout_editor_absoluteX="67dp"
tools:text="Hello World" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
tools:text="sdfsfsfsfs" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Hello World" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激。