Ionic Selectable
An Ionic component similar to Ionic Select, that allows to search items, including async search, infinite scrolling and more.
Contents
Getting started
-
Decide on the version you want to use Free
or Pro
. See Version comparison to help you choose.
-
Install it.
Ionic Selectable Free
npm install ionic-selectable --save
Ionic Selectable Pro
Purchase it from Ionic Market.
Copy ionic-selectable-3.0.3.tgz
archive to the root of your project. Then cd
to the project root and install the package.
npm install ionic-selectable-3.0.3.tgz
- Import it.
import { IonicSelectableModule } from 'ionic-selectable';
@NgModule({
imports: [
IonicSelectableModule
]
})
export class AppModule { }
- Add it to template.
<ion-item>
<ion-label>Port</ion-label>
<ionic-selectable
item-content
[(ngModel)]="port"
[items]="ports"
itemValueField="id"
itemTextField="name"
[canSearch]="true"
(onChange)="portChange($event)">
</ionic-selectable>
</ion-item>
- Configure it.
import { IonicSelectableComponent } from 'ionic-selectable';
class Port {
public id: number;
public name: string;
}
@Component({ ... })
export class HomePage {
ports: Port[];
port: Port;
constructor() {
this.ports = [
{ id: 1, name: 'Tokai' },
{ id: 2, name: 'Vladivostok' },
{ id: 3, name: 'Navlakhi' }
];
}
portChange(event: {
component: IonicSelectableComponent,
value: any
}) {
console.log('port:', event.value);
}
}
- Enjoy it 😉
- Check out live demos for Ionic Selectable Free and Ionic Selectable Pro to see what it is capable of.
Also, explore the docs and FAQ to learn more about its features.
Version comparison
Share it
If you find this component useful, please star the repo to let others know that it's reliable. Also, share it with friends and colleagues who might find it useful as well. Thank you 😄