Enable filtering by setting the filter option to true. Filtering happens on the client side by default, however remote filtering can be implemented using the onFilter event.

Get started with this example

Demo

Loading the live demo

Preview in full screen

Code

import { CommonModule } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { MbscModule, MbscSelectOptions, setOptions  } from '@mobiscroll/angular';

setOptions({
  locale:  ,
  theme: ' ',
  themeVariant: ' '
});

@Component({
  selector: 'app-root', 
  templateUrl: './app.component.html',
  standalone: true,
  imports: [CommonModule, MbscModule],
})
export class AppComponent implements OnInit {
  names = [
    {
      text: 'Abigail Hodges',
      value: 1,
    },
    {
      text: 'Adam Robertson',
      value: 2,
    },
    {
      text: 'Blake Nolan',
      value: 3,
    },
    {
      text: 'Dylan Manning',
      value: 4,
    },
    {
      text: 'Jane Clarkson',
      value: 5,
    },
    {
      text: 'Julian Parr',
      value: 6,
    },
    {
      text: 'Lily Blake',
      value: 7,
    },
    {
      text: 'Luke Wright',
      value: 8,
    },
    {
      text: 'Nathan Poole',
      value: 9,
    },
    {
      text: 'Olivia Vance',
      value: 10,
    },
    {
      text: 'Paul Hudson',
      value: 11,
    },
    {
      text: 'Rose Taylor',
      value: 12,
    },
    {
      text: 'Samantha Martin',
      value: 13,
    },
    {
      text: 'Steven Cameron',
      value: 14,
    },
    {
      text: 'Wanda Mills',
      value: 15,
    },
  ];

  remoteData: any;

  remoteOptions: MbscSelectOptions = {
    onFilter: (ev: any) => {
      this.remoteFiltering(ev.filterText);
      return false;
    },
  };

  constructor(private http: HttpClient) {}

  ngOnInit(): void {
    this.remoteFiltering('');
  }

  remoteFiltering(filterText: any): void {
    this.http.jsonp<any>('https://trial.mobiscroll.com/airports/' + encodeURIComponent(filterText), 'callback').subscribe((data) => {
      const airports = [];
      for (const item of data) {
        airports.push({ text: item.name, value: item.code });
      }
      this.remoteData = airports;
    });
  }
}

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.