Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 我们如何将值绑定到<;离子选择>;_Ionic Framework_Ionic4 - Fatal编程技术网

Ionic framework 我们如何将值绑定到<;离子选择>;

Ionic framework 我们如何将值绑定到<;离子选择>;,ionic-framework,ionic4,Ionic Framework,Ionic4,我已经通过formController绑定了值,但它没有正确绑定, 这就是我如何绑定.ts文件上的值 this.rental.setValue(scheme, { emitEvent: false, onlySelf: true }); 这是相关的HTML <ion-item> <ion-label position="floating"> SCHEME</ion-label> <ion-select placeholder="Sele

我已经通过formController绑定了值,但它没有正确绑定, 这就是我如何绑定.ts文件上的值

this.rental.setValue(scheme, { emitEvent: false, onlySelf: true });
这是相关的HTML

<ion-item>
    <ion-label position="floating"> SCHEME</ion-label>
    <ion-select placeholder="Select" formControlName="rental" interface="popover">
        <ion-select-option *ngFor="let scheme of product" [value]="scheme">
            <p class="color-gray font-12 text-align-right bold">
                {{scheme.description}}
            </p>
        </ion-select-option>
    </ion-select>
</ion-item>

计划

{{scheme.description}}


产品是一个对象数组

在离子选择中也使用值标记



Ref:

您还可以在ion select中使用ngModel标记,如

<ion-select placeholder="Select" [(ngModel)]="rental" interface="popover">
    <ion-select-option *ngFor="let scheme of product" value="scheme">
        <p class="color-gray font-12 text-align-right bold">
            {{scheme.description}}
        </p>
    </ion-select-option>
</ion-select>

{{scheme.description}}