I have tried to run the code on different devices and still can Not pass the blank white screen!
If I remove contacts import, everything works fine, but with the contacts code in it, whole program stucks on the load.
Please, do you have Any Suggestions?
this is my code:
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,private contacts: Contacts) { }
showButton(){
alert(‘activated’);
let contact: Contact = this.contacts.create();
contact.name = new ContactName(null, ‘Chat’, ‘Contact’);
contact.phoneNumbers = [new ContactField(‘mobile’, ‘123456789’)];
contact.save().then(
() => console.log(‘Contact saved!’, contact),
(error: any) => console.error(‘Error saving contact.’, error)
);
}
}
home.html
Show Contact Page…
<button ion-button color=“secondary” (click)=“showButton()”>Show Conact
System information:
Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
I have tested it on the android and iphone, both with the same results …