eakoriakin / ionic-selectable

Ionic Selectable is an Ionic versatile and highly customizable component that serves as a replacement to Ionic Select, and allows to search items, including async search, create items, customize the layout with templates and much more. It provides an intuitive API and is easy to set up and use.
MIT License
550 stars 123 forks source link

ionicSelectableItemTemplate in V2 #428

Closed owndeveloped closed 1 year ago

owndeveloped commented 1 year ago

I haven't gotten the templates to work in V5. This is my code:

<ion-item>
      <ion-label>Ocupacion</ion-label>
      <ionic-selectable 
        itemValueField="clave" 
        itemTextField="clave"
        [items]="listaTablaOcupacion" 
        [canSearch]="true">

        <ng-template 
        ionicSelectableItemTemplate 
        let-ocupacion="item"
        let-isOcupacionSelected="isItemSelected">
        <ion-label text-wrap>{{ocupacion.clave}} - {{ocupacion.descripcion}}</ion-label>
        </ng-template>
      </ionic-selectable>
    </ion-item>

The "listaTablaOcupacion" has the following data structure: [ { "clave": "a", "descripcion": "a - Personal en trabajos exclusivos de oficina." },... ]

iamrsojitra commented 1 year ago

Hello @owndeveloped Greetings!

If you are using a standalone component, v5.0.2 is the latest version of the npm package. Also, make sure to import IonicSelectableItemTemplateDirective in your component to work.

Thanks

owndeveloped commented 1 year ago

I forgot to import IonicSelectableItemTemplateDirective. Thanks for the reply.