Improve search page

This commit is contained in:
Peter Maquiran
2021-01-19 16:44:39 +01:00
parent 4a5395be94
commit d2fc8338b3
20 changed files with 421 additions and 101 deletions
+20 -12
View File
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { ContactsService } from 'src/app/services/contacts.service';
import { EventPerson } from 'src/app/models/eventperson.model';
@Component({
selector: 'app-sender',
templateUrl: './sender.page.html',
@@ -12,7 +13,8 @@ export class SenderPage implements OnInit {
contacts: EventPerson[];
showContacts: EventPerson[];
sender: string;
selectedUser: string;
constructor(private modalController:ModalController,
private ContactsService: ContactsService) {
@@ -28,23 +30,29 @@ export class SenderPage implements OnInit {
this.contacts = res;
});
}
filterContact(){
filterContact(findName){
console.log(findName)
// const persons = this.contacts.filter((person) => {
const findPerson = this.sender.toLowerCase();
const persons = this.contacts.filter((person) => {
// if (person.Name.indexOf(findName) == 0){
// return true;
// }
if (person.Name.toLowerCase().indexOf(findPerson) == 0){
return true;
}
// });
// this.showContacts = persons;
});
this.showContacts = persons;
}
close(){
this.modalController.dismiss();
selectUser(username:string){
console.log(username);
this.selectedUser = username;
this.close(this.selectedUser);
}
close(username: string){
this.modalController.dismiss(username);
}
}