I’ve created a custom component using cli command
ionic generate component my-component
Everything works fine, the only problem I’m facing is I am unable to render ion input directives like ion-input, ion-radio etc inside my custom component
I’ve called my component inside a page like this
<my-compo></my-compo>
This is html of my component
<ion-label fixed>Title</ion-label>
<ion-input type="text" value=""></ion-input>
ion-label shows up just fine, but ion-input doesn’t render at all.
Any guess?
Do matters improve if you wrap your component’s template inside an <ion-item>
?
Its already wrapped inside ion-item
<ion-list>
<ion-item text-wrap *ngFor="let html of survey.structure">
<my-compo></my-compo>
</ion-item>
</ion-list>
@casperkotwal Try to change your code to include item-content
in your custom component:
<ion-list>
<ion-item text-wrap *ngFor="let html of survey.structure">
<my-compo item-content></my-compo>
</ion-item>
</ion-list>
Or include the ion-item
inside your custom component:
<ion-item text-wrap>
<ion-label fixed>Title</ion-label>
<ion-input type="text" value=""></ion-input>
</ion-item>
and use it like:
<ion-list>
<my-compo *ngFor="let html of survey.structure"></my-compo>
</ion-list>
More info here:
@chrisbodon You can try to use the ion-item html properties, like item-content, to allow elements aside from labels and inputs inside it:
<ion-list>
<ion-item>
<ion-grid item-content>
<ion-row>
<ion-col col-3><ion-input type="text" value=""></ion-input></ion-col>
<ion-col col-3><ion-input type="text" value=""></ion-input></ion-col>
<ion-col col-3><ion-input type="text" value=""></ion-input></ion-col>
<io…
1 Like