4
我想查询使用离子2本机的所有联系人。运行ionic serve命令时出现以下错误。如果有人知道请让我知道,我该如何解决这个问题。谢谢离子2本地联系人插件查找不退出
Typescript Error
Property 'find' does not exist on type 'typeof Contacts'.
home.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController) {
}
testFun(){
Contacts.find(['*']).then((contacts)=>{
alert(JSON.stringify(contacts[0]));
})
}
}
home.html的
<ion-header>
<ion-navbar>
<ion-title>
Ionic Blank
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<button ion-button full (click)="testFun()">Get Contacts</button>
</ion-content>
官方文档我想你的解决方案,但没有运气还是我得到了同样的问题。 – cfprabhu
请看我的代码https://github.com/cfprabhu21/ionic2Native-contacts – cfprabhu
对不起,我之前写错了,我编辑了我的答案,使用'''this.contacts.find()'''而不是' 'contact.find()''' – TriDiamond