Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70775

Ionic v.4 really get my info from provider

$
0
0

@BBenard wrote:

Hi,
In constructor :
I get a free id with an API from a provider in my code.
this.idContact = myProfil.getUserId();
the console.log of my provider tells me that the idContact is known
[ng] [console.log]: "Current user : 8"

then
in ionViewWillEnter
I want to get the data for this user with another API request

  ionViewWillEnter() {
    console.log('ionViewDidEnter idContact : ' + this.idContact);
    this.getUserData(this.idContact);
  }

But finally, this.idContact is undefined !! Whereas the log just above told me it had a value ?!
[ng] [console.log]: "ionViewDidEnter idContact : undefined"

what’s wrong in this code according to you ?
(maybe should I use promises ? I could need help to do it…)

(Note : there is no ‘ionic-v4’ category to post in this forum. I posted in ionic-v3)
Thanks :wink:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70775

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>