简体   繁体   English

Ionic 6 Angular slot="error" 不适用于 ion-checkbox 和 ion-radio-group

[英]Ionic 6 Angular slot="error" doesn't work with ion-checkbox and ion-radio-group

I am trying slot error , it works for more of the input fields, but seems it doesn't work for ion-checkbox and for the ion-radio-group .我正在尝试 slot error ,它适用于更多输入字段,但似乎不适用于 ion-checkbox 和 ion-radio-group 。 In the in the .ts file I have.在我拥有的 .ts 文件中。

private buildForm() {
        this.form = this.formBuilder.group({
            'checkBox':[null, [Validators.required]],
            'radioButtonGroup':[null, [Validators.required]],
        });
    }

and in the .html template并在 .html 模板中

   <ion-item>
        <ion-label position="stacked">Check box</ion-label>
        <ion-checkbox position="fixed" formControlName="checkBox"></ion-checkbox>
        <ion-note slot="error"> Please select</ion-note>
    </ion-item>

    <ion-list >
        <ion-radio-group formControlName="radioButtonGroup" >
            <ion-list-header>
                <ion-label>Radio button Group</ion-label>
            </ion-list-header>

            <ion-item>
                <ion-label>Selection1</ion-label>
                <ion-radio slot="start" value="Selection1"></ion-radio>
            </ion-item>
            <ion-item>
                <ion-label>Selection3</ion-label>
                <ion-radio slot="start" value="Selection3"></ion-radio>
            </ion-item>
        </ion-radio-group>
        <ion-note slot="error"> Please select</ion-note>
    </ion-list>

Please for your help.请为您的帮助。

In general seems its supported only for input fields.一般来说,它似乎只支持输入字段。 Here its the detailed answer from Ionic team .这是 Ionic 团队的详细回答。 https://github.com/ionic-team/ionic-framework/issues/25332 https://github.com/ionic-team/ionic-framework/issues/25332

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM