充电页面时,离子选择未选择默认值

时间:2019-10-14 19:14:07

标签: angular typescript ionic-framework

这是我的html代码

Math.round(addition)

这将对您页面中的页面收费。

    <ion-label position="floating">Actividad Laboral</ion-label>
        <ion-select formControlName="idActividadLaboral" cancelText="Cancelar" okText="OK">
            <ion-select-option *ngFor="let subitem of giroEmpresaList" [value]="subitem.id">{{ subitem.nombre }}</ion-select-option>
        </ion-select>

更改页面时,所选值不会返回到该项目。加载页面时该怎么办?我可以显示“默认”值的“项目”吗?

结果已经以这种方式编译。

    onInit(){
        this.generalForm = new FormGroup({
            idTipoTrabajo: new FormControl([this.item.idTipoTrabajo], Validators.compose([
                Validators.required;
        });
    }

我用过:

    <ion-item _ngcontent-grd-c9="" class="input-item item-has-value item-label item-label-floating item md in-list ion-activatable ion-focusable ion-untouched ion-pristine ion-valid hydrated item-interactive item-select">
        <ion-label _ngcontent-grd-c9="" position="floating" class="sc-ion-label-md-h sc-ion-label-md-s md label-floating hydrated" ng-reflect-position="floating" id="ion-sel-0-lbl">Job Type</ion-label>
        <ion-select _ngcontent-grd-c9="" formcontrolname="idJobType" ng-reflect-name="idJobType" ng-reflect-cancel-text="Cancelar" ng-reflect-ok-text="OK" class="ng-untouched ng-pristine ng-valid ion-untouched ion-pristine ion-valid md in-item hydrated" role="combobox" aria-haspopup="dialog" aria-expanded="false" aria-labelledby="ion-sel-0-lbl">
         <ion-select-option _ngcontent-grd-c9="" ng-reflect-value="1" role="option" id="ion-selopt-18" class="md hydrated">FORMAL</ion-select-option>
         <input type="hidden" class="aux-input" name="ion-sel-0" value="1">
         </ion-select>
     </ion-item>

0 个答案:

没有答案