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

@Component({
  selector: 'app-tab2',
  templateUrl: 'tab2.page.html',
  styleUrls: ['tab2.page.scss']
})
export class Tab2Page {
  friends: { name: string }[] = [
    { name: 'Alice' },
    { name: 'Bob' },
    { name: 'Charlie' },
    { name: 'David' },
    
  ];
  searchTerm: string = '';
  filteredFriends: { name: string }[] = [];

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

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