import { Component } from '@angular/core';

interface Friend {
  name: string;
  phoneNumber: string;
  gender: string;
}

@Component({
  selector: 'app-tab2',
  templateUrl: 'tab2.page.html',
  styleUrls: ['tab2.page.scss']
})
export class Tab2Page {

  friends: Friend[] = [
    { name: 'Alice', phoneNumber: '1234567890', gender: 'Female' },
    { name: 'Bob', phoneNumber: '0987654321', gender: 'Male' },
    { name: 'Eve', phoneNumber: '5556667777', gender: 'Female' }
  ];

  filteredFriends: Friend[] = [];

  searchTerm: string = '';

  constructor() {
    this.filteredFriends = this.friends;
  }

  filterFriends() {
    this.filteredFriends = this.friends.filter(friend => {
      return friend.name.toLowerCase().includes(this.searchTerm.toLowerCase());
    });
  }

}