ionic-search2

0.0.0 • Public • Published

Ionic Select with Searchbar

NPM Version NPM Downloads

An Ionic component similar to ion-select, that allows to search items, including async search and infinite scrolling.

Contents

Demo

iOS

iOS Demo 1 iOS Demo 2

Android

Android Demo 1 Android Demo 2

Download

Download it using npm:

npm install ionic-select-searchable --save

Getting started

  1. Import SelectSearchable to your main app module.
import { NgModule } from '@angular/core';
import { SelectSearchableModule } from 'ionic-select-searchable';

@NgModule({
    ...
    imports: [
        ...
        SelectSearchableModule
    ],
    ...
})
export class AppModule { }

  1. Add SelectSearchable to your component template.
<ion-item>
    <select-searchable
        title="Port"
        [(ngModel)]="port"
        [items]="ports"
        itemValueField="id"
        itemTextField="name"
        [canSearch]="true"
        (onChange)="portChange($event)">
    </select-searchable>
</ion-item>
  1. Prepare your component file for SelectSearchable.
import { Component } from '@angular/core';
import { SelectSearchable } from 'ionic-select-searchable';

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: SelectSearchable, value: any }) {
        console.log('port:', event.value);
    }
}

Support this project

If you find this project useful, please star the repo to let people know that it's reliable. Also, share it with friends and colleagues that might find this useful as well. Thank you 😄

/ionic-search2/

    Package Sidebar

    Install

    npm i ionic-search2

    Weekly Downloads

    0

    Version

    0.0.0

    License

    MIT

    Unpacked Size

    136 kB

    Total Files

    21

    Last publish

    Collaborators

    • danielfnz