0

I am trying to fetch the device phone number of the mobile phone on which the ionic app is installed I am using
(ionic cordova plugin add cordova-plugin-sim)
I do get an object as response,
What i need to find is what are the elements of the abject as i need to parse it.
Code below
The HTML file

<ion-content padding>
<button ion-button full (click)="getDeviceInfo()">Password Reset</button>
  <ion-item>
    {{deviceInfo}}
  </ion-item>
</ion-content>

The typescript file

getDeviceInfo(){
this.sim.getSimInfo().then((info)=>{
  this.deviceInfo = info;
  console.log(this.deviceInfo);
  alert(this.deviceInfo);
}, Error=>{
  alert('Could not capture device information!');
});
}

The response i get is an object [Object][Object]
I tried looking at the log cat in android studio but did not find anything

How do i parse this? Any advise will be great help.
Thanks in advance

shiben
  • 23
  • 3
  • 11
  • Possible duplicate of [How can I display a JavaScript object?](https://stackoverflow.com/questions/957537/how-can-i-display-a-javascript-object) – LuckyStarr Dec 04 '17 at 11:35

1 Answers1

0

Convert the object into a string using JSON.stringify

console.log(JSON.stringify(this.deviceInfo));
99tharun
  • 1,216
  • 3
  • 20
  • 36