typescript - Ionic find contacts -
i trying search in ionic 2 application on phone number has +1 in front of it.
import { component } '@angular/core'; import { ionicpage, navcontroller, navparams } 'ionic-angular'; import { callnumber } '@ionic-native/call-number'; import {contacts, contact, contactfield, contactaddress, contactname,contactfindoptions} '@ionic-native/contacts'; import {contactinterface} "../../models/interfaces/contactinterface"; /** * generated class contactmenupage page. * * see http://ionicframework.com/docs/components/#navigation more info * on ionic pages , navigation. */ @ionicpage() @component({ selector: 'page-contact-menu', templateurl: 'contact-menu.html', }) export class contactmenupage { contact : contactinterface; constructor(public navctrl: navcontroller, public navparams: navparams, private callnumber: callnumber, private contactctrl: contacts) { this.contact = this.navparams.get('contact'); this.contact.exists = false; } ionviewdidload() { this.contact.exists = false; console.log(this.contact.cell[0]); var options = new contactfindoptions(); options.hasphonenumber = true; options.filter = this.contact.cell[0]; options.multiple = true; this.contactctrl.find(['phonenumbers'], options).then( (contacts) => { console.log(contacts); } ); }
whenever gives me first contact added contacts list. must not give me if there no matches.
could give me pointers?
the code above uses contact plugin cordova , returns array of contact objects. dont know why wasnt working before working above code fine
Comments
Post a Comment